-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
32 lines (24 loc) · 841 Bytes
/
utils.js
File metadata and controls
32 lines (24 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var fs = require('fs');
var path = require('path');
exports.spawnPython = function (script_path, params, callback) {
var spawn = require("child_process").spawn;
var process = spawn('python',[script_path, params]);
process.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
process.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
process.on('exit', function(code) {
console.log(script_path + " exited with code: " + code);
if(callback != undefined) {
callback(code);
}
})
};
exports.getFilesAfterDate = function (dir, date) {
var files = fs.readdirSync(dir);
return files.filter(function(file) {
return fs.statSync(path.join(dir, file)).mtime.getTime() > date && file[0] != ".";
})
};