firebase-ios-sdk
firebase-ios-sdk copied to clipboard
[FR]: Set chunk size on upload task
Description
I may be missing something very obvious, but I see no way to set the upload chunk size from swift code for a 'FIRStorageUploadTask' created via FIRStorageReference putFile. e.g.
let uploadTask = remoteRef.putFile(from: fileURL, metadata: metadata)
- Use case: allow custom chunk sizes so resumable uploads work by default
- Currently the chunk size seems hard coded to a large value
- I propose allowing custom chunk sizes
In FIRStorageUploadTask.m the chunk size seems to be set from the constant kGTMSessionUploadFetcherStandardChunkSize
which is set to LLONG_MAX;
GTMSessionUploadFetcher *uploadFetcher =
[GTMSessionUploadFetcher uploadFetcherWithRequest:request
uploadMIMEType:strongSelf->_uploadMetadata.contentType
chunkSize:kGTMSessionUploadFetcherStandardChunkSize
fetcherService:self.fetcherService];
Perhaps there is a way to modify this somewhere, but I can't find any documentation on it.
Thanks for any support.
API Proposal
let uploadTask = remoteRef.putFile(from: fileURL, metadata: metadata, chunkSize: myChunkSize )
Firebase Product(s)
Storage
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
@cclaan Thank for the feature request. You're correct that there's currently no way to change chunkSize
from LLONG_MAX
We've begun work on a Swift-only V2 API for Storage in #10161. chunkSize
could work well as a default argument in the new API.
@cclaan Would you provide more description about the value of being able to set the chunkSize
. Why do you want to be able to manage the upload in smaller chunks?
My use case is uploading ~20mb files from a phone with potentially poor network connection. Using smaller chunks is required so that the upload does not restart from scratch every time the network drops. ( Previously chunkSize was LLONG_MAX )