walk.on('dir', function (dir, stat) { uploadDir.push(dir); });
I am using Node, and i need make this function run everyday at midnight, this is possible?
I believe the node-schedule package will suit your needs. Generally, you want so-called cron to schedule and run your server tasks.
With node-schedule:
import schedule from 'node-schedule' schedule.scheduleJob('0 0 * * *', () => { ... }) // run everyday at midnight
2.1m questions
2.1m answers
60 comments
56.9k users