Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support asynchronous read-file function (aka read-from-stream) (#321)
Support async function for readFileFn Since implementing a good concurrency-handler may be painful we provide a promise-based read-locking one so that asyncReadFileFn is safe to use out-of-the-box. Given that streams-read are often unable to correctly/exactly compute their final amount of bytes to upload, the number of chunks may also be off. We handle this in a safe way via FlowChunk.readBytes: - if read using an async function - and the last chunk read less bytes than usual (including 0) - and the current chunk read no byte - assume that this chunk is in fact superfluous and simulate its completion. Previous discussion on: * #42 * #318 (In the long-term Flow.js may have to support the concept of "approximate chunk number")
- Loading branch information