比如下面的代码stream 在使用后就会被消费掉,但是我想多次操作这个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);
1 回答
- 1 回答
- 0 关注
- 525 浏览
添加回答
举报
0/150
提交
取消