Convert to streams2 readable streams using through2() #646
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This patch converts all through streams created using through to be streams2 streams using through2. I ran into an issue where I expected the stream returned by
bundle()
to buffer data until I read from it (steams2 semantics).Example
The bundle stream emits its data immediately before the stream-stream is ready to read from it. I am interested in hearing if there is a better approach I should be using to concatenate static js to my browserify bundle.
Note: This is broken nondeterministically, only when
static.js
is sufficiently large.Details
Tests passed as-is except for
test/standalone_events.js
. This is because the test is expecting aclose
event and it seems like streams2 readable streams do not emit one by default nor do they propagate close events from piped streams. I changed this test to note expect aclose
event.Many tests use
through()
and I did not change those - I moved through to devDependencies.Things to Review
objectMode
in the right placesstream.resume()
to automatically start flowing where it made sense (e.g., when there is a callback given).close
event be emitted?