Remix.run Logo
domh 5 days ago

Same thing can be said about Streams in Node.js as well. They had a working streams implementation before the Web Streams API was in browsers (iirc). So implementing the standard now means removing what's already there, or breaking a lot of existing code.

Which leads to confusing things like the fact that there are two streams APIs in Node now:

Streams: https://nodejs.org/docs/latest/api/stream.html

Web Streams: https://nodejs.org/docs/latest/api/webstreams.html

And they have to support going back and forth between the two: https://nodejs.org/docs/latest/api/webstreams.html#nodejs-st...

It's exactly the same story for crypto as well. Node created it's own standard, Web standards emerged, Node has to support both:

https://nodejs.org/docs/latest/api/crypto.html

https://nodejs.org/docs/latest/api/webcrypto.html

Fwiw I think it's good they're not removing the legacy code, but they should probably do a big cleanup major release and lean into the modern standards and remove the old stuff. But there's obviously push back in doing so... and probably stuff you can do in the old modules that you can't do in the new and vice versa.

franciscop 3 days ago | parent [-]

Yes, I've dealt with streams a lot and I've seen the pain. I'd say it's the 2nd biggest "compat breaking" of Node/JS after the require vs esm, but while the require vs esm is mostly gone (we all use esm nowadays, except for aham the default npm) the stream types I expect will last for a long while since that's not so "high" in the productivity list for most. Also, that's actually one of the main pains I have with Node NOT supporting Fetchable, the fact that the Body is not a Readable.

When we used to code by hand, Bun used to have an amazing list of articles on how to convert from almost any kind of streamable to almost any other type. I used it a lot, and that was when I started liking Bun so much.