-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.readlineIssues and PRs related to the built-in readline module.Issues and PRs related to the built-in readline module.
Description
Currently, readline module interface is rather special. Interface class is EventEmitter acting as stream, but not conforming to Stream interface. It's possible to redirect output to stream, but it's significantly less convenient than just .pipe.
Then I propose one of the following:
- add class
readline.StreamsubclassingTransform.readline.Interfacecan be backed by this stream, then no code duplication occurs. Though, I'm not sure about viability of this approach, asInterfacecontains lots of code related to TTY handling.
- make
readline.Interfaceinstances subclasses ofTransformstream
Compare:
foo = getReadableStream();
bar = transformStream();
foo
.pipe(readline.Stream())
.pipe(bar)
.pipe(process.stdout)vs.
foo = getReadableStream();
bar = transformStream();
readline.createInterface({
input: foo,
output: bar
}); // We are using factory function for side effects.
bar.pipe(process.stdout);User-land packages providing this functionality:
- byline (423k downloads per month)
clakech, linusnorton, bitdivine, lagden, js-choi and 18 more
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.readlineIssues and PRs related to the built-in readline module.Issues and PRs related to the built-in readline module.