I want to implement file download with 'Range' header and can't receive necessary headers in response. Here is a part where them should be defined but in 1.3 version I don't receive 'Content-Length' - https://github.com/appwrite/appwrite/blob/af7cbef0245a33fc83eb0587d11355fc34395ac9/app/controllers/api/storage.php#L1033-L1037
My request looks like [GET]: https://myhost.com/v1/storage/buckets/bucket_id/files/file_id/download headers: x-appwrite-project: project_id Range: bytes=0-1
what's the response headers for that?
the header should have a content-range:
content-range: bytes 0-1/<CONTENT-LENGTH>
also, if you do get file, that should have the sizeOriginal
I didn't record exact set of headers. But I saw content-range. Is it always full length? BTW, it would be really useful if any type of download could return that content-size. At least we can calculate estimate of the download using that.
Sorry what do you mean?
As far as I know, when I download any file using URLSessionDelegate I receive progress of download in delegate, but if a server doesn't send Content-Length header with full length the progress will be always 0
interesting...do you know the details about what it actually does and how?
Our framework chunks responses bigger than a certain amount and doesn't return the content-length header when it does that. However, this is expected from an HTTP perspective
https://developer.apple.com/documentation/foundation/nsurlsessiondownloaddelegate/1409408-urlsession
totalBytesExpectedToWrite
The expected length of the file, as provided by the Content-Length header. If this header was not provided, the value is NSURLSessionTransferSizeUnknown.
And usually I calculate the progress by totalBytesWritten/totalBytesExpectedToWrite
interesting...
@dlohani, here's another case where Content-Length header is used
Thank you for the info about content-range. I'll try to parse it.
Recommended threads
- Error getting preview of file
Rest Response: ``` { "message": "Server Error", "code": 500, "type": "general_unknown", "version": "1.8.1" } ``` Appwrite Logs ``` appwrite ...
- Storage images using custom domain retur...
Some of the images uploaded to my storage bucket returns this error: ``` { "message": "Project with the requested ID could not be found. Please check the value...
- Bandwidth limit for your organization ha...
I received an alert that I exceeded the Free plan bandwidth limit (showing 5.86 GB), but my dashboard tells a different story. The usage stats there are much lo...