You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's because the streamPassThrough starts paused, so the close and end events are never emitted and the promise never resolves. See Node.js Streams, two reading modes. When you attach the data handler, it unpauses and eventually the close and end events are emitted, resolving the promise.
I have the following nodejs code, where I try to append readable streams to node-archiver and pipe the archiver to a nodejs PassThrough stream:
However, with the
streamPassThrough
event handler for'data'
commented out:The code never leave the Promise,
check 5.1
tocheck 5.8
gets printed butcheck 6
never gets printed.The weird thing is that if I un-comment out the
streamPassThrough
event handler for'data'
, like this:Then it works fine and
check 6
is printed.What is going on here?
Why does the
streamPassThrough
event handler for'data'
affects the code at all?The text was updated successfully, but these errors were encountered: