Class: ChunkedUploader

ChunkedUploader(client, uploadSessionInfo, file, size, optionsopt)

Manager for uploading a file in chunks

Constructor

new ChunkedUploader(client, uploadSessionInfo, file, size, optionsopt)

Create an upload manager
Parameters:
Name Type Attributes Description
client BoxClient The client to use to upload the file
uploadSessionInfo Object The upload session info to use for chunked upload
file ReadableStream | Buffer | string The file to upload
size int The size of the file to be uploaded
options Object <optional>
Optional parameters
Properties
Name Type Attributes Default Description
retryInterval int <optional>
1000 The number of ms to wait before retrying operations
parallelism int <optional>
4 The number of concurrent chunks to upload
fileAttributes Object <optional>
Attributes to set on the file during commit
Source:

Classes

ChunkedUploader

Methods

_commit() → {void}

Commit the upload, finalizing it
Source:
Fires:
  • ChunkedUploader#event:uploadComplete
  • ChunkedUploader#event:error
Returns:
Type
void

_commit() → {void}

Commit the upload, finalizing it
Source:
Fires:
  • ChunkedUploader#event:uploadComplete
  • ChunkedUploader#event:error
Returns:
Type
void

_uploadChunk(chunk) → {void}

Upload a chunk
Parameters:
Name Type Description
chunk Chunk The chunk to upload
Source:
Fires:
  • ChunkedUploader#event:chunkError
  • ChunkedUploader#event:chunkUploaded
Returns:
Type
void

_uploadChunk(chunk) → {void}

Upload a chunk
Parameters:
Name Type Description
chunk Chunk The chunk to upload
Source:
Fires:
  • ChunkedUploader#event:chunkError
  • ChunkedUploader#event:chunkUploaded
Returns:
Type
void

abort() → {Promise}

Abort a running upload, which cancels all currently uploading chunks, attempts to free up held memory, and aborts the upload session. This cannot be undone or resumed.
Source:
Fires:
  • ChunkedUploader#event:aborted
  • ChunkedUploader#event:abortFailed
Returns:
A promise resolving when the upload is aborted
Type
Promise

abort() → {Promise}

Abort a running upload, which cancels all currently uploading chunks, attempts to free up held memory, and aborts the upload session. This cannot be undone or resumed.
Source:
Fires:
  • ChunkedUploader#event:aborted
  • ChunkedUploader#event:abortFailed
Returns:
A promise resolving when the upload is aborted
Type
Promise

start() → {Promise.<Object>}

Start an upload
Source:
Returns:
A promise resolving to the uploaded file
Type
Promise.<Object>

start() → {Promise.<Object>}

Start an upload
Source:
Returns:
A promise resolving to the uploaded file
Type
Promise.<Object>