Ask for a piece of a file with Range and resume a broken download: how many bytes come, what does a gudang without Range or a request past the end get back…
Range is behind downloads that resume, videos you can seek to any minute, and PDFs loaded a page at a time. But a server may ignore it, both its ends count, a Range past the end makes a 416, and a file replaced halfway quietly breaks a download unless you use If-Range and check the status.
A 206 joins on, a 200 replaces
Range and answer 200 with the whole file. Look for Accept-Ranges: bytes on its answer, and never join without looking at its status.bytes=0-499 is 500 bytes: byte 0 through byte 499, both in. Being one off here makes pieces overlap or leave a hole.206 or 200 A 200 holds the whole file: joining it to the old piece makes the download doubled and broken. Check res.status === 206 and Content-Range before joining; on a 200, start over.If-Range If the file changed since the first piece, Range alone gives you a piece of the new version, and the result is a mix of two files. If-Range with the old ETag makes the server send the new file whole.bytes=0-499 500 bytes come: both ends count.416 with Content-Range: bytes */1000.