Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我从 NodeJS 中得到一个缓冲区(我可以把它变成一个字符串)child_process.exec()。我需要遍历输出字符串的行。我该怎么做?
child_process.exec()
避免在内存中拆分整个内容的一种方法是一次处理一行
var i = 0; while (i < output.length) { var j = output.indexOf("\\n", i); if (j == -1) j = output.length; .... process output.substr(i, j-i) .... i = j+1; }