Skip to content

Comments

chore: replace through2 with node:stream#47

Open
SethFalco wants to merge 1 commit intotimkendrick:masterfrom
SethFalco:streams
Open

chore: replace through2 with node:stream#47
SethFalco wants to merge 1 commit intotimkendrick:masterfrom
SethFalco:streams

Conversation

@SethFalco
Copy link

@SethFalco SethFalco commented Feb 15, 2026

Migrates from the through2 npm package to standard Node.js stream API. This is one less direct dependency, and speeds up what I think would be an organic flow for many users to follow anyway. (i.e. to read the through2 documentation, then migrate to node:stream)

This is based on a recommendation which can be found on the through2 README.

Do you need this?

Since Node.js introduced Simplified Stream Construction, many uses of through2 have become redundant. Consider whether you really need to use through2 or just want to use the 'readable-stream' package, or the core 'stream' package (which is derived from 'readable-stream'):

const { Transform } = require('readable-stream')

const transformer = new Transform({
  transform(chunk, enc, callback) {
    // ...
  }
})

through2 - npm

I followed that advice and we applied it to github.com/Vukory/thesis-frontend#eleventy.config.js, which worked out fine.

I originally only planned to amend the documentation, but I opted to amend the tests too, to be 100% sure that this interface can be used to pass all test cases defined.

@SethFalco SethFalco changed the title chore: replace through2 with stream chore: replace through2 with node:stream Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant