您无法使用javascript打开文件客户端。
您可以在服务器端使用node.js进行操作。
fs.readFile(FILE_LOCATION, function (err, data) { if (err) throw err; if(data.indexOf('search string') >= 0){ console.log(data) }});较新版本的node.js(> = 6.0.0)具有该
includes功能,该功能可在字符串中搜索匹配项。
fs.readFile(FILE_LOCATION, function (err, data) { if (err) throw err; if(data.includes('search string')){ console.log(data) }});


