比如下面的代碼stream 在使用后就會被消費(fèi)掉,但是我想多次操作這個stream,該怎么解決呢,我下面的代碼是通過fs方式再次獲得,但是io太過于頻繁了 const stream = await ctx.getFileStream(); const fs = require('fs'); const qhash = '123123'; // 寫文件
await new Promise(resolve =>
stream
.pipe(fs.createWriteStream(`upload/${qhash}.zip`))
.on('finish', resolve));
getManifest(`upload/${qhash}.zip`); const stream2 = await fs.createReadStream(`upload/${qhash}.zip`); const sssssshash = await qetag(stream2); const stream3 = await fs.createReadStream(`upload/${qhash}.zip`); // console.log(buffer);
nodejs 中的Stream流如何復(fù)制使用呢
猛跑小豬
2018-07-21 07:52:40