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.
This is an attempt to fix #31.
Currently as mentioned in the issue description the workflow is:
Again as mentioned in the issue description it seems that the 'finish' event is not emitted.
This probably happens as a consequence of backpressure handling. The write queue of the transform stream (
w
) is filled so no more data is read from the source (r
) until the'drain'
event is emitted but this never happens because no one is reading from the readable side ofw
.This also explains why it work with a small 16x16 image. If the image is smaller than
highWaterMark
which defaults to 16384 bytes, then the'finish'
event should always be emitted.A possible fix was to add a listener for the
'data'
event tow
, save all data chunks and merge them on'finish'
.This patch saves and merges all data chunks but also removes the
base64-stream
dependency. Conversion to base64 is done after all chunks are concatenated and using the built-inbuf.toString('base64')
method.