Pass stream as parameter to onFinish handler
See original GitHub issueI have a Node stream that can emit an error and can also emit content afterwards.
Example:
import {
PassThrough
} from 'stream';
const passthrough = new stream.PassThrough();
passthrough.pipe(process.stdout);
passthrough.emit(new Error('boom'));
passthrough.write('foo'); // This gets written to process.stdout, even though an error was emitted.
I’d like to handle the error and continue. I can do so if we update pipeReadable
to call onFinish
with stream
as a third parameter.
This way I can override error handling to write a new StreamError
without ending.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top Results From Across the Web
Implement finish event handler of custom writable stream class
The finish event and its signature is documented here. It does not have any parameters, it's merely a notification that the writable stream...
Read more >Stream | Node.js v19.3.0 Documentation
The listener callback is passed a single Error argument when called. The stream is closed when the 'error' event is emitted unless the...
Read more >How To Work with Files Using Streams in Node.js - DigitalOcean
Streams are an efficient way to handle files in Node.js. ... an array that contains the command-line arguments passed to a Node.js script....
Read more >How to use Bloc with streams and concurrency
Bloc 7.2.0 and 8.0.0 introduce a new way to register event handlers. This article provides examples showing the old bloc syntax and how...
Read more >Understanding Streams in Node.js - NodeSource
The parameter options is optional and can, among other things, be used to specify a text encoding. const { Readable } = require('stream');...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
3.0.0-beta.3
released.Yes. I will do that when I merge the PR.