max-mapper/concat-stream

Is this package still maintained?

JacobMGEvans opened this issue · 1 comments

Is this package still maintained?

i guess not. I persume there is a easier way to concat streams with async iterable + generators.

async function * concat (...streams) {
  // if this ain't working
  for (const stream of ...streams) yield * stream

  // maybe this can 
  // for (const stream of ...streams) {
  //   for await (const data of stream) yield data
  // }
}

const a = fs.createReadStream('chunk1')
const b = fs.createReadStream('chunk2')
const iterable = concat(a, b)

const stream = stream.Readable.from( iterable )

I have not tested it... but i guess it can work.

but then again you could just do this to avoid the stream impl all togheter and build a more cross friendly code that works in more enviorment and dose not depend on node:streams

const a = fs.createReadStream('chunk1')
const b = fs.createReadStream('chunk2')

for await (const data of concat(a, b)) {
  console.log(data)
}