Answer the question
In order to leave comments, you need to log in
How to calculate correctly parameters for Range in headers?
Hello. I'm trying to resume uploading large files after an ECONNRESET error.
let options = {
headers: {
'Content-Type': 'multipart/form-data',
"Accept-Ranges": "bytes",
"Range": `bytes=${lastBytes}-${size}/${size}`
}
};
Answer the question
In order to leave comments, you need to log in
1. Does the server support range at all?
2. Try to download first with wget. If it works, then at least it's possible to download it in principle. If not, then Node.js will fail.
3. It might be worth trying to limit the data retrieval rate (first with wget).
`bytes=${lastBytes}-${size}/${size}`
This is generally a template string, not a mathematical expression. The server will never understand you.
https://developer.mozilla.org/ru/docs/Web/HTTP/Hea...
In your case, it will be enough Range: bytes=${lastBytes}-
to check that the server understood you correctly - http status 206 should be.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question