Create a clean stream using fs.createReadStream #764
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.
Relevant issues
#756
#634
The
stream
is piped inres
. Next the stream generate an errorThe first argument must be one of type string or Buffer. Received type number
and launchs thesatus["500"]()
function then thestatus["500"]()
function modify headers (after the piped stream), that's the crashing error appear.To counter that, the stream musn't create error, we can :
stream = Readable.from(bytes)
tostream = Readable.from(bytes.toString())
stream = Readable.from(bytes)
because a correct stream is created with line 334BUT using .toString() format the buffer and a different charset can produce an error (see
toString()
innpm run test
).This PR is the second (and working) option
Contributor checklist
--help
outputmaster
branchMaintainer checklist