Describe the bug
When using Readable streams with uploadLengthDeferred: true, the upload hangs if the total stream size is an exact multiple of chunkSize. This issue does not occur when:
The total stream size is not divisible by chunk size.
The upload uses a known Upload-Length.
To Reproduce
This code snippet from the client side would reproduce the issue
`const input = new stream.PassThrough();
input.end("my hello WORLD"); // 14 bytes
const upload = new Upload(input, {
endpoint: "/uploads",
chunkSize: 7,
uploadLengthDeferred: true,
onSuccess: () => console.log("Upload complete"),
});
upload.start();`
Expected behavior
Upload completes with Upload-Length sent in the final PATCH.
Actual behavior
Upload hangs after final chunk if size % chunkSize === 0.
Setup details
- Runtime environment: Node.js
- Used tus-js-client version: 4.3.1
- Used tus server software: tus/server