How to copy and use Stream streams in nodejs

for example, the following code
stream will be consumed after use, but I want to operate this stream, many times. My following code is obtained again through fs, but Io is too frequent

.
 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);

   
Mar.28,2021

try stream.PassThrough
reference: https://stackoverflow.com/que.


Hello, have you solved it? I also need to get the stream operation from ctx.getFileStream () many times now. How do you do it?

Menu