Tus
2 flashcards · Programming Languages · by lakesare
Does tus-js-client presume ajax requests, or WebSocket requests?
Tus presumes ajax requests! PATCH requests, which can optionally be POST. WebSockets are only used when we are exchanging the progress of the upload with the Companion server.
Why does Tus sometimes send multiple PATCH requests, or one PATCH request, independent of the size of the file?
It depends on the chunkSize option. By default it's Infinity, which means that the browser will be uploading all bytes in one request. But you can make it any other value - e.g. if you make it 1000, browser will send multiple PATCH requests, each of which will send 1000 bytes. import tus from 'tus-js-client'; const upload = new tus.Upload(file, { endpoint: "http://localhost:1080/files/", chunkSize: 1000 })