Running a function everyday midnight

后端 未结 4 1493
难免孤独
难免孤独 2020-12-05 04:42
walk.on(\'dir\', function (dir, stat) {
    uploadDir.push(dir);
});

I am using Node, and i need make this function run everyday at midnight, this

4条回答
  •  没有蜡笔的小新
    2020-12-05 05:26

    There is a node package for this node-schedule.

    You can do something like this:

    var j = schedule.scheduleJob({hour: 00, minute: 00}, function(){
        walk.on('dir', function (dir, stat) {
           uploadDir.push(dir);
        });
    });
    

    For more info, see here

提交回复
热议问题