-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: enable bytes read tracking #1074
feat: enable bytes read tracking #1074
Conversation
@AVaksman I forgot about this: https://github.com/googleapis/gcs-resumable-upload/blob/4cec8f74a408ea8dc03e3395555189fa6b09add0/src/index.ts#L451 Looks like we could just forward that event to the user (during resumable uploads, anyway) |
That's good! |
Yes, I suppose we should. What do you think? |
Blocked by
|
src/file.ts
Outdated
@@ -1698,7 +1701,7 @@ class File extends ServiceObject<File> { | |||
pumpify([ | |||
gzip ? zlib.createGzip() : through(), | |||
validateStream, | |||
fileWriteStream, | |||
fileWriteStream.on('progress', evt => stream.emit('progress', evt)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put this event handler assignment on its own line? Just makes it easier to see what the code does line-by-line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a subjective suggestion, but LGTM.
enables bytes read tracking from simple upload
@bcoe |
Codecov Report
@@ Coverage Diff @@
## master #1074 +/- ##
=======================================
Coverage 99.16% 99.16%
=======================================
Files 12 12
Lines 11474 11474
Branches 597 597
=======================================
Hits 11378 11378
Misses 95 95
Partials 1 1 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this feature is really slick, if @stephenplusplus has given his 👍 I say ship it.
There does not seem to be a way to track progress using the |
I was wrong. |
Design: Changes to
file.createWriteStream()
Introduce a
ProgressStream
class that extends from nativeTrasform
'progress'
event with total calculatedbytesRead
value.add an instance of ProgressStream to the pipe.
If
options.onUploadProgress
is provided by user add a'progress'
listener that passes the totalbytesRead
value tooptions.onUploadProgress
.Ensure the tests and linter pass
Code coverage does not decrease (if any source code was changed)
Appropriate docs were updated (if necessary)
Fixes #956