You can not open files client side with javascript.
You can do it with node.js though on the server side.
fs.readFile(FILE_LOCATION, function (err, data) {
if (err) throw err;
if(data.indexOf('search string') >= 0){
console.log(data) //Do Things
}
});
Newer versions of node.js (>= 6.0.0) have the includes
function, which searches for a match in a string.
fs.readFile(FILE_LOCATION, function (err, data) {
if (err) throw err;
if(data.includes('search string')){
console.log(data)
}
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…