What does HackerNews think of readable-stream?

Node-core streams for userland

Language: JavaScript

#13 in Node.js
#50 in Node.js
It's pretty easy to find that the example I gave isn't gamed... A cursory search on GitHub can find a couple examples like dotenv [1] and npm's cli [2] both use it via an older version of nodejs/readable-stream [3].

There's also the classic left-pad debacle - https://github.com/left-pad/left-pad/issues/4

[1] - https://github.com/motdotla/dotenv/blob/master/package-lock....

[2] - https://github.com/npm/cli/blob/latest/package-lock.json

[3] - https://github.com/nodejs/readable-stream/

Some general thoughts, which may or may not be practical depending on how the transpiling works (I have no idea about go):

- Instead of calling .Print(), have the class extend EventEmitter (node builtin, https://github.com/primus/eventemitter3 is a good browser shim for the same API), with an event that fires once for each line that terminates with a newline.

- Hard mode of the above: Add streams functionality (node builtin, https://github.com/nodejs/readable-stream is an official browser shim for the same API), with output streams that operate on bytes instead of lines.

- Combine parser and printer into a single ES6 class (e.g. using `new Parser()` syntax, rather than the indirect object generation).

- In optional addition to the above, have .parse() return a Promise for the output (not the parsed program), with parsed programs stored on the Parser itself (and examinable via an additional class method).

- Change all method names to be in camelCase instead of PascalCase. Only classes (as instantiated using `new`, not just methods that generate class objects) get PascalCase.

> You might have to drop support for one version or the other or you add in some hacks to try and figure out which APIs you can and cannot use.

If this happens, there will probably be compatibility modules like https://github.com/nodejs/readable-stream.