You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AbortController is available as a built-in on all platforms. readable-stream currently uses the abort-controller dependency. Since AbortController already exists, this dependency can be removed, which decreases the size of readable-stream while increasing supply chain security. Furthermore, native implementations are likely faster.
AbortController was added in Node 14.17.0. However, readable-stream supports Node 12 and higher (see README). So I'm afraid we can't remove this dependency just yet.
Note that if globalThis.AbortController exists, readable-stream will use it and not load abort-controller:
So if you don't need to support Node 12 in your app and can assume that globalThis.AbortController will always exist, you can configure your package manager or bundler to remove that dependency while building.
If that's the case, a conditional dependency should be used. This would allow abort-controller to not be installed when using a new enough version of Node.
@james-pre Unfortunately that would be a breaking change for existing consumers as well 😢
So next breaking change would either drop v12 support (which means we could use native AbortController) or add abort-controller in optionalPeerDependencies.
If I can choose, I would choose for option number 1 and just go native
@mcollina It seems this package drops older versions of Node with every major, so I'm wondering if you'd be willing to accept a PR for dropping Node 12 support?
I can even drop Node 14 & 16 support if you want to, but I would understand if that would be way too much at once.
Thanks for the reply. I agree with uping the major Node.js version. It might be worth going all the way to Node 20, since that is the current maintenance release (still older than LTS).
The only way this is solved is by releasing a new major. I would say it's in the Roadmap, maybe from the code in Node 26. This means it would target 22+ or 20+. But... most Node.js users are better off in using node:stream directly. There are still valid cases to use this, but every single time we ship a new major, the downloads of the previous majors do not decrease.
Activity
MattiasBuelens commentedon Feb 13, 2025
AbortControllerwas added in Node 14.17.0. However,readable-streamsupports Node 12 and higher (see README). So I'm afraid we can't remove this dependency just yet.Note that if
globalThis.AbortControllerexists,readable-streamwill use it and not loadabort-controller:readable-stream/lib/ours/util.js
Lines 9 to 10 in 88df210
So if you don't need to support Node 12 in your app and can assume that
globalThis.AbortControllerwill always exist, you can configure your package manager or bundler to remove that dependency while building.james-pre commentedon Feb 13, 2025
If that's the case, a conditional dependency should be used. This would allow abort-controller to not be installed when using a new enough version of Node.
MichaelDeBoey commentedon Aug 7, 2025
@james-pre Unfortunately that would be a breaking change for existing consumers as well 😢
So next breaking change would either drop v12 support (which means we could use native
AbortController) or addabort-controllerinoptionalPeerDependencies.If I can choose, I would choose for option number 1 and just go native
@mcollina It seems this package drops older versions of Node with every major, so I'm wondering if you'd be willing to accept a PR for dropping Node 12 support?
I can even drop Node 14 & 16 support if you want to, but I would understand if that would be way too much at once.
james-pre commentedon Aug 7, 2025
Hey @MichaelDeBoey,
Thanks for the reply. I agree with uping the major Node.js version. It might be worth going all the way to Node 20, since that is the current maintenance release (still older than LTS).
james-pre commentedon Apr 3, 2026
Hey maintainers! It's been over a year since this issue was opened, any chance we could see a new version to clean up the rotting dependency tree?
mcollina commentedon Apr 5, 2026
The only way this is solved is by releasing a new major. I would say it's in the Roadmap, maybe from the code in Node 26. This means it would target 22+ or 20+. But... most Node.js users are better off in using node:stream directly. There are still valid cases to use this, but every single time we ship a new major, the downloads of the previous majors do not decrease.