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?
See Question&Answers more detail:oswalk.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?
See Question&Answers more detail:osI 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