0
我有以下脚本:如果的NodeJS字符串包含执行脚本
function execute(){
require("fs").readFile("sometextfile.txt", function(err, cont) {
if (err)
throw err;
console.log("ALERT:"+(cont.indexOf("mystring")>-1 ? " " : " not ")+"found!");
});
}
setInterval(execute,9000);
我只希望如果字符串包含执行一个javascript“警告:发现”
脚本:
var Prowl = require('node-prowl');
var prowl = new Prowl('API');
prowl.push('ALERT', 'ALERT2', function(err, remaining){
if(err) throw err;
console.log('I have ' + remaining + ' calls to the api during current hour. BOOM!');
});
帮助!
你从自己的代码中得到了什么样的输出? –