How can I create a temporary files folder?

So I’m working in a file converter app so it is saving files into the server. Then I want to delete the converted files after a while, or maybe every reset of the glitch app.

How can I approach this? Any better idea?

child_process.execSync(‘rm PATH_TO_DIR’)
console.log(‘that was easy XD’)


Hey @ElBort,

As @Jonyk56 mentioned, you can execute a command in the Console, which removes a specified directory.
For instance, once you have converted the file and send the download link to certain someone, you can return a function or line of code, which removes the file. There are a few packages that bring this functionality to the app. One such package is fs-extra. Here’s an example of ‘how to remove a directory using the package’:

const fs = require('fs-extra');
// with callback: fs.remove('/path/to/the/dir', callback);

Good luck!


Thank you both. I will try it later :grin: