Skip to content
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

onUploadProgress is not triggering. #319

Closed
cihanbey211 opened this issue Sep 7, 2022 · 6 comments
Closed

onUploadProgress is not triggering. #319

cihanbey211 opened this issue Sep 7, 2022 · 6 comments

Comments

@cihanbey211
Copy link

cihanbey211 commented Sep 7, 2022

Hi everyone; Firstly thank you for this module. I need onUploadProgress trigger for big files, but not triggering. I need help yours about issue.

function uploadFile(client) { console.log('Start'); const file = fs.createReadStream("./video.mp4"); client.putFileContents("/video.mp4", file, { overwrite: false, onUploadProgress: progress => { console.log(progress); } }); }

@perry-mitchell
Copy link
Owner

Hi @cihanbey211 - just confirming, are you using this in the browser or node?

@cihanbey211
Copy link
Author

Hi @cihanbey211 - just confirming, are you using this in the browser or node?

Hi sir, i couldn't get views on either side, is there a way you suggest?

@mtdvlpr
Copy link

mtdvlpr commented Nov 27, 2022

@perry-mitchell, I also have this issue. I'm using it in the browser, but it only triggers once when the upload is done.

@perry-mitchell
Copy link
Owner

I'm not sure what could be happening here, though to be honest I've not really used those functions in my own projects. From what I've seen they are incredibly unstable and work for some while never for others. That and such methods are not available on the new Fetch standard.

It's sad to say but these methods (upload/download progress) will disappear on v5 of this library, when I switch away from Axios (for Fetch). Progress will be possible to calculate by viewing the stream position when streaming files to or from the remote source, but not via normal options. I don't want to implement these myself (as they'd be problematic, just bloat for most people and only available reliably on the Node side).

I'll leave this issue open if someone's interested in fixing this for V4 (not sure how that'd be possible, as we simply pass these properties on to Axios, so any bug is most likely there), but I'll close it when V5 is stable.

@mtdvlpr
Copy link

mtdvlpr commented Nov 27, 2022

Okay, thanks for the explanation!

@perry-mitchell
Copy link
Owner

Confirmed with the latest set of changes - upload/download progress will be dropped. Using streams + middleware to measure progress is the best way, especially because streams are better than buffering an entire file beforehand (usually required to be able to know upload size, and therefore progress (total/percentage)).

I'll try to add an example for this at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants