flowjs / flow.js

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

Support asynchronous read-file function (asyncReadFileFn) #304

Closed drzraf closed 3 years ago

drzraf commented 4 years ago

See #295, #296 and #300

AidasK commented 4 years ago

Can you also check that async is compiled in dist/ folder to ES5 via grunt? This way you could use promises everywhere. Though you might need to update examples and docs due to a breaking changes

drzraf commented 4 years ago
AidasK commented 4 years ago

The thing is that grunt does not compile files to es5, that means that browsers are going to crash if they do not support async syntax. That is why we need to update grunt minify method to recompile file to es5.

AidasK commented 4 years ago

Is this ready to be merged?

drzraf commented 4 years ago

No, I'm revamping the PR because the way I checked for asynchronicity of function is not compatible with bundled code. (I'll provide a test too). https://github.com/flowjs/flow.js/pull/309 is a prerequisite as this brings in a transpilation toolchain and testing transpiled code instead of sourcecode.

drzraf commented 4 years ago

Note: I observed problems with progress event reporting using test/FakeXMLHttpRequestUpload.js (see https://github.com/flowjs/flow.js/pull/313)

drzraf commented 3 years ago

Added more tests about chunk size mismatch. I ran a couple of random tests, all succeeded.

Test File is 36 bytes long. Now uploads 18 simultaneous chunks of at most 7 bytes
Test File is 31 bytes long. Now uploads 6 simultaneous chunks of at most 8 bytes
Test File is 7 bytes long. Now uploads 15 simultaneous chunks of at most 11 bytes
Test File is 66 bytes long. Now uploads 19 simultaneous chunks of at most 16 bytes
Test File is 29 bytes long. Now uploads 16 simultaneous chunks of at most 13 bytes
Test File is 84 bytes long. Now uploads 14 simultaneous chunks of at most 2 bytes
Test File is 49 bytes long. Now uploads 2 simultaneous chunks of at most 24 bytes
Test File is 24 bytes long. Now uploads 20 simultaneous chunks of at most 7 bytes
Test File is 41 bytes long. Now uploads 13 simultaneous chunks of at most 28 bytes
Test File is 17 bytes long. Now uploads 17 simultaneous chunks of at most 5 bytes
Test File is 21 bytes long. Now uploads 11 simultaneous chunks of at most 2 bytes
Test File is 16 bytes long. Now uploads 15 simultaneous chunks of at most 3 bytes
Test File is 67 bytes long. Now uploads 15 simultaneous chunks of at most 24 bytes
Test File is 65 bytes long. Now uploads 6 simultaneous chunks of at most 10 bytes
Test File is 14 bytes long. Now uploads 14 simultaneous chunks of at most 2 bytes
Test File is 83 bytes long. Now uploads 18 simultaneous chunks of at most 10 bytes
Test File is 76 bytes long. Now uploads 1 simultaneous chunks of at most 3 bytes
Test File is 2 bytes long. Now uploads 11 simultaneous chunks of at most 4 bytes
Test File is 34 bytes long. Now uploads 5 simultaneous chunks of at most 2 bytes
Test File is 87 bytes long. Now uploads 15 simultaneous chunks of at most 8 bytes
Test File is 16 bytes long. Now uploads 9 simultaneous chunks of at most 2 bytes
Test File is 23 bytes long. Now uploads 13 simultaneous chunks of at most 5 bytes
Test File is 91 bytes long. Now uploads 1 simultaneous chunks of at most 5 bytes
Test File is 69 bytes long. Now uploads 11 simultaneous chunks of at most 4 bytes
Test File is 40 bytes long. Now uploads 1 simultaneous chunks of at most 6 bytes
Test File is 54 bytes long. Now uploads 6 simultaneous chunks of at most 9 bytes
Test File is 31 bytes long. Now uploads 8 simultaneous chunks of at most 13 bytes
Test File is 15 bytes long. Now uploads 2 simultaneous chunks of at most 1 bytes
Test File is 42 bytes long. Now uploads 10 simultaneous chunks of at most 11 bytes
Test File is 40 bytes long. Now uploads 1 simultaneous chunks of at most 25 bytes
drzraf commented 3 years ago

Closing in favor of #321