Putting Transforms created by through2.obj first when using stream.compose function (introduced in Node.js 16) with object inputs causes type error, just like putting non-object Transforms in it does. Nevertheless, putting normal Transforms created by its constructor first and through2.obj in the middle works right.
Though using normal Transforms avoids the problem, as a lot of plugins like in gulp use through2 internally, it would be nice if this can be fixed.
TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of File
at new NodeError (node:internal/errors:387:5)
at _write (node:internal/streams/writable:314:13)
at ComposeDuplex.Writable.write (node:internal/streams/writable:336:10)
at Readable.ondata (node:internal/streams/readable:754:22)
at Readable.emit (node:events:513:28)
at Readable.emit (node:domain:552:15)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Readable.push (node:internal/streams/readable:228:10)
at Projects\...\node_modules\fork-stream\index.js:51:13
Putting
Transform
s created bythrough2.obj
first when usingstream.compose
function (introduced in Node.js 16) with object inputs causes type error, just like putting non-objectTransform
s in it does. Nevertheless, putting normalTransform
s created by its constructor first andthrough2.obj
in the middle works right.Though using normal
Transform
s avoids the problem, as a lot of plugins like ingulp
usethrough2
internally, it would be nice if this can be fixed.Node version: v16.17.1
Snippet:
The error log: