muxinc / upchunk

Uploads Chunks! Takes big files, splits them up, then uploads each one with care (and PUT requests).
MIT License
345 stars 46 forks source link

[Feature Request] Resume upload from last uploaded chunk after page reload or when resuming download from a different client. #21

Open motion-x86 opened 4 years ago

motion-x86 commented 4 years ago

This will allow downloads to resume after a page reload or different client.

mmcc commented 4 years ago

Hm I really like this idea, but I'm struggling a bit with where this line should be for the library itself. How would you feel about us exposing the tools to be able to build this yourself? My first thought is we expose more details about the "chunk mapping" for lack of a better phrase, then make sure to include more details about which chunks were successfully completed via events. From there we'd just need a way of configuring which chunk to start at when initializing the upload.

Thoughts?

motion-x86 commented 4 years ago

I think that sounds about right, we already have the attempt and attemptFailure events which allow us to store the index of the last successful chunk upload. What I did is simply add this line to the UpChunk constructor:

this.chunkCount = options.beginAtChunk || 0; and IOptions beginAtChunk ?: number;

With that in place I was able to resume a download from the last uploaded chunk successfully.

MartinMalinda commented 3 years ago

@motion-x86

Thanks for the issue, it got me thinking. For the file upload to resume from last location the user has to select the same file I assume.

How do you handle this? Do you also store file name in the localStorage and do a check for that?

And I guess BE (Mux or other) also cleans up unfinished uploads after some time, so there needs to be a check for that also.

hfossli-agens commented 2 years ago

Any progress on this from @mmcc / mux? :)