s3-upload-stream
s3-upload-stream copied to clipboard
Change handling of end override so finish gets called at a more appropriate time
In the current version, by calling ws.originalEnd before cleaning up remaining data, a finish event is emitted which can cause problems if the user's code assumes finish means no more work will be done. I ran into this with pump, which will destroy a stream as soon as it gets a finish/close/end. Thus, the early finish was swallowing errors which would have otherwise been reported. Seems probable that, without this fix, the last flush of data could be accidentally blocked.