flowjs / flow.js

A JavaScript library providing multiple simultaneous, stable, fault-tolerant and resumable/restartable file uploads via the HTML5 File API.
Other
2.97k stars 347 forks source link

Issue while retrying uploads #388

Open choicl opened 3 months ago

choicl commented 3 months ago

Hi everyone, I have an issue with retrying uploads. I've been uploading small files (less or equal 100KB), sizeUploaded() for them were the same as files size, but short-term disconnection happened and the code reached retry case case 'retry': this.flowObj.fire('fileRetry', this, chunk); break;
Files were already uploaded, however the retry was fired multiple times and then just failed. Shouldn't the file size be checked while file upload retrying?

AidasK commented 3 months ago

Hi! File size check is optional as this is not a stream upload. It's uploading in chunks and file for each chunk is created only if file upload succeeds. Also partial file upload is not possible since we are doing a chunk rename instead of a copy. And lastly we do check the size of each chunk as it's not cpu intensive. Answers are based on php implementation here https://github.com/flowjs/flow-php-server/blob/master/src/Flow/File.php#L79

choicl commented 3 months ago

@AidasK thank you for the answer! Now I'm just trying to understand, can it be somehow configured within flowjs npm package or it requires some custom handling from my side?