wolkenkit icon indicating copy to clipboard operation
wolkenkit copied to clipboard

Notify about progress when uploading / downloading files

Open goloroden opened this issue 6 years ago • 1 comments

What is this feature about?

Right now, when uploading or downloading a large file to or from file storage, you just have to wait. It would be great if there was an option to get notified about the progress being made. We already have figured out an API for this:

client.on(`progress::${id}`, ({ type, progress, elapsedTime, estimatedRemainingTime }) => {
  // type: 'upload', 'download'
  // progress: 0..100 (in %, not rounded)
  // elapsedTime: 0..x (in milliseconds)
  // estimatedRemainingTime: 0..x (in milliseconds)
});

Internally, once progress 100 has been reached, all event listeners for the appropriate ID should automatically be removed.

Additionally, you can provide an onProgress callback to the addFile and getFile calls.

What needs to be done to implement this feature?

  • [x] Implement the new API in the wolkenkit-depot-client-js module
  • [x] Add tests
  • [ ] Update documentation

What else should we know?

This issue was brought up by @SteffenGottschalk, so we should notify him once this has been done.

goloroden avatar Mar 16 '19 10:03 goloroden

Unfortunately, axios calls the onUploadProgess and onDownloadProgress events in a very unreliable way (which is probably caused by the underlying implementation of the browsers):

  • In Node.js, the events are not supported at all.
  • In Chrome (macOS and Windows) the events also never happen.

I didn't test Firefox, but if it doesn't work in Chrome, I think it's questionable whether it makes sense to implement this. I also tested this with a large file (of almost 2 gb in size), but again, no events happened.

Hence, I am going to close this issue, we won't implement this.

goloroden avatar Mar 20 '19 11:03 goloroden