Repository navigation
Storage streams use 'complete' event for end of stream but built-in streams use 'finish' #362
Description
Activity
- addedtype: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.
on Jan 23, 2015 Our complete event comes from
request: https://github.com/request/request/blob/e33a883dd412dc7a1fdd1e1f282e840faa540609/request.js#L1224Being consistent with
fswould be nice, but off hand, I'm not sure we can do that.Ooh, I forgot about our new proxy stream. Yeah, we should be able to emit whatever we choose in these cases.
This is quite complex.
A native readable stream is done when it emits 'end', which is the same time the stream is
.end()-ed. Theendlistener doesn't receive arguments, and if you pass arguments tostream.end(), they get written to the stream immediately prior to being ended. I wonder if this is why request usescomplete, so they can do some post-processing before emitting the response headers/body/status arguments.I'm okay with keeping
completeas the consistent event for readable and writable end signals.Oh yeah, good observation. That looks like exactly what they are doing. I'm happy with this too. It just makes it look weird when you have pipe with different streams, but in either case you have to make sure you're using the right event.
completeas a consistent "yo, im done now" event is good for me.- added 2 commits that reference this issue
on Sep 27, 2022 - added a commit that references this issue
on Oct 13, 2022 15 remaining items
- added a commit that references this issue
on Jul 23, 2025 - added a commit that references this issue
on Feb 25, 2026 - added 2 commits that reference this issue
on Feb 26, 2026 - added 2 commits that reference this issue
on Mar 9, 2026 - added a commit that references this issue
on Mar 27, 2026
As was raised in #340, I looked into why there was a discrepancy between what the developer thought and what was the real case. There was a suggestion made to update our docs, but our docs aren't the issue here. A snippet from the tests shows the issue:
Using
'finish'event:Using
'complete'event:Seems the only difference is the type of file that is getting piped to. In the first case, it's a regular stream from
fsand in the second it's our implementation of the storage file write stream.So my question is, should we use a consistent
finishevent everywhere or is this by-design or otherwise okay?