muxinc / upchunk

Uploads Chunks! Takes big files, splits them up, then uploads each one with care (and PUT requests).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

motion-x86 opened this issue · comments

commented

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

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?

commented

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.

@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.

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