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!');
});
幫助!
你從自己的代碼中得到了什麼樣的輸出? –