高级前端
node
【Q674】在 Node 中如何读取可读流的内容

在 Node 中如何读取可读流的内容

Issue 欢迎在 Gtihub Issue 中回答此问题: Issue 693 (opens in a new tab)

Author 回答者: Asarua (opens in a new tab)

fs.createReadStream吗,有人知道了踢我一下

Author 回答者: shfshanyue (opens in a new tab)

let data = "";
stream.on("data", (chunk) => (data += chunk));
stream.on("end", () => console.log(data));