Chunk upload
Uploading files in chunks
For large documents it's better using files Chunk API which allows splitting upload into separate REST API requests reducing memory consumption and providing a more manageable upload mechanism.
Files Chunk API appeared in SharePoint 2016 and should not be expected to work in the previous version.
Chunk upload can't be used in SharePoint 2013
Basic chunk upload example
Upload flow
Fluent API abstracts some aspects of the chunked upload. Internally, /StartUpload
, /ContinueUpload
, /CancelUpload
, and /FinishUpload
endpoints are used. However, these are not exposed for the simplicity. Nonetheless, there is a way for canceling upload with the help of api.AddChunkedOptions
.
Add chunked options
There are a few options which are optional. The third method parameter is a configuration structure.
Defaults are: Overwrite
is true and ChunkSize
equals to 10485760 bytes.
Progress
callback allows not only trigger a progress logic, for example upload percentage update, but also to cancel an upload. To cancel an upload the progress callback should return false
.
Last updated