question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use pump with a Transform Stream as final stream object

See original GitHub issue

Using pump like this;

pump.apply null, [
  tcpSocket
  transformStream
  writableStream
  handleEndFn
]

will call the handleEndFn just fine when the TCP socket breaks / closes.

Now, due to the way the destroyer passes its arguments (based on the stream object position) to the end-of-stream module, the following

pump.apply null, [
  tcpSocket
  transformStream
  transformStream
  handleEndFn
]

will not trigger the handleEndFn function (allowHalfOpen defaults to true).

What would be the handest way to circumfence the obliged applcation of pump, but now using a Transform Stream as the last stream object in the pipeline?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sprijkcommented, Nov 17, 2017

Ah yes. Thanks a lot for explaining!

0reactions
mafintoshcommented, Nov 17, 2017
new Writable objectMode: true, write: (c, e, cb) -> cb()

By calling the cb right away you never hit backpressure yes

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using readable streams - Web APIs | MDN
As our Simple stream pump example shows (see it live also), exposing it is a matter of just accessing the body property of...
Read more >
Backpressuring in Streams
This is a module method to pipe between streams forwarding errors and properly cleaning up and provide a callback when the pipeline is...
Read more >
Using Streams · Cloudflare Workers docs
You can use TransformStream to stream a response body after sending ... This example just pumps the subrequest response body to the final...
Read more >
Long Object Stream with Asynchronous Transform Ending ...
I am piping the response from a Node request into a transform stream using through2Concurrent . This response comes in as a buffer...
Read more >
Process streaming JSON with Node.js | by Jake Burden
It's also a good habit to use a module called pump to handle the streams. Pump handles closing streams if the destination closes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found