使用JavaScript(位置像http://example.com/directory/file.txt)打开文本文件并检查该文件是否包含给定的字符串/变量,这是否可能?
在PHP中可以轻松地完成此操作,例如:
$file = file_get_contents("filename.ext");
if (!strpos($file, "search string")) {
echo "String not found!";
} else {
echo "String found!";
}
有没有办法做到这一点?我在使用Node.js、appfog运行一个.js
文件中的“function”。