Skip to content

Conversation

terreng
Copy link

@terreng terreng commented Jul 14, 2024

This fixes a bug for me where the steam would never end for certain files.

When doing something like

response.body
.pipe(transcoder)
.pipe(new dfpwm.Encoder())
.pipe(fs.createWriteStream(path.join(temp_dir, 'output.dfpwm')))
.on('finish', function() {
    console.log('Done')
})

it would complete and the file would be written successfully but would never call finish.

This is fixed with a slight modification to _flush in the encoder class to push the final encoded buffer to the stream before calling the callback fn.

make sure the stream ends correctly by pushing the final data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant