You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

18 lines
387 B

  1. import fs from 'fs'
  2. import path from 'path'
  3. export default eventHandler(async (event) => {
  4. const directoryPath = path.join(process.cwd(), 'media/files/screenshit/')
  5. try {
  6. const files = await fs.promises.readdir(directoryPath)
  7. return files.filter(file => !file.startsWith('.'))
  8. } catch (error) {
  9. return {
  10. success: false,
  11. error: error.message
  12. }
  13. }
  14. })