Class: Files

Files(client)

Simple manager for interacting with all 'File' endpoints and actions.

Constructor

new Files(client)

Parameters:
Name Type Description
client BoxClient The Box API Client that is responsible for making calls to the API
Source:

Members

(readonly) representation :FileRepresentationType

Enum of valid x-rep- hint values for generating representation info
Type:
Source:

Methods

abortUploadSession(sessionID, callbackopt) → {Promise.<void>}

Abort an upload session, discarding any chunks that were uploaded to it API Endpoint: '/files/upload_sessions/:sessionID' Method: DELETE
Parameters:
Name Type Attributes Description
sessionID string The ID of the upload session to commit
callback function <optional>
Passed nothing if successful, error otherwise
Source:
Returns:
A promise resolving to nothing
Type
Promise.<void>

abortUploadSession(sessionID, callbackopt) → {Promise.<void>}

Abort an upload session, discarding any chunks that were uploaded to it API Endpoint: '/files/upload_sessions/:sessionID' Method: DELETE
Parameters:
Name Type Attributes Description
sessionID string The ID of the upload session to commit
callback function <optional>
Passed nothing if successful, error otherwise
Source:
Returns:
A promise resolving to nothing
Type
Promise.<void>

addMetadata(fileID, scope, template, data, callbackopt) → {Promise.<Object>}

Adds metadata to a file. Metadata must either match a template schema or be placed into the unstructured "properties" template in global scope. API Endpoint: '/files/:fileID/metadata/:scope/:template' Method: POST
Parameters:
Name Type Attributes Description
fileID string The ID of the file to add metadata to
scope string The scope of the metadata template, e.g. "enterprise"
template string The metadata template schema to add
data Object Key/value pairs tp add as metadata
callback function <optional>
Called with error if unsuccessful
Source:
Returns:
A promise resolving to the new metadata
Type
Promise.<Object>

addMetadata(fileID, scope, template, data, callbackopt) → {Promise.<Object>}

Adds metadata to a file. Metadata must either match a template schema or be placed into the unstructured "properties" template in global scope. API Endpoint: '/files/:fileID/metadata/:scope/:template' Method: POST
Parameters:
Name Type Attributes Description
fileID string The ID of the file to add metadata to
scope string The scope of the metadata template, e.g. "enterprise"
template string The metadata template schema to add
data Object Key/value pairs tp add as metadata
callback function <optional>
Called with error if unsuccessful
Source:
Returns:
A promise resolving to the new metadata
Type
Promise.<Object>

addToCollection(fileID, collectionID, callbackopt) → {Promise.<Object>}

Add a file to a given collection API Endpoint: '/files/:fileID' Method: PUT
Parameters:
Name Type Attributes Description
fileID string The file to add to the collection
collectionID string The collection to add the file to
callback function <optional>
Passed the updated file if successful, error otherwise
Source:
Returns:
A promise resolving to the updated file object
Type
Promise.<Object>

addToCollection(fileID, collectionID, callbackopt) → {Promise.<Object>}

Add a file to a given collection API Endpoint: '/files/:fileID' Method: PUT
Parameters:
Name Type Attributes Description
fileID string The file to add to the collection
collectionID string The collection to add the file to
callback function <optional>
Passed the updated file if successful, error otherwise
Source:
Returns:
A promise resolving to the updated file object
Type
Promise.<Object>

applyWatermark(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Used to apply or update the watermark for a corresponding Box file. API Endpoint: '/files/:fileID/watermark' Method: PUT
Parameters:
Name Type Attributes Description
fileID string The Box ID of the file to update watermark for
options Object <optional>
Optional parameters, can be left null
callback function <optional>
Passed the watermark information if successful, error otherwise
Source:
Returns:
A promise resolving to the watermark info
Type
Promise.<Object>

applyWatermark(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Used to apply or update the watermark for a corresponding Box file. API Endpoint: '/files/:fileID/watermark' Method: PUT
Parameters:
Name Type Attributes Description
fileID string The Box ID of the file to update watermark for
options Object <optional>
Optional parameters, can be left null
callback function <optional>
Passed the watermark information if successful, error otherwise
Source:
Returns:
A promise resolving to the watermark info
Type
Promise.<Object>

commitUploadSession(sessionID, fileHash, optionsopt, callbackopt) → {Promise.<Object>}

Commit an upload session after all parts have been uploaded, creating the new file API Endpoint: '/files/upload_sessions/:sessionID/commit' Method: POST
Parameters:
Name Type Attributes Description
sessionID string The ID of the upload session to commit
fileHash string The base64-encoded SHA-1 hash of the file being uploaded
options Object <optional>
Optional parameters set on the created file, can be left null
Properties
Name Type Attributes Description
parts Array.<UploadPart> <optional>
The list of uploaded parts to be committed, will be fetched from the API otherwise
description string <optional>
Optional description of the uploaded file.
callback function <optional>
Passed the new file information if successful
Source:
Returns:
A promise resolving to the uploaded file object
Type
Promise.<Object>

commitUploadSession(sessionID, fileHash, optionsopt, callbackopt) → {Promise.<Object>}

Commit an upload session after all parts have been uploaded, creating the new file API Endpoint: '/files/upload_sessions/:sessionID/commit' Method: POST
Parameters:
Name Type Attributes Description
sessionID string The ID of the upload session to commit
fileHash string The base64-encoded SHA-1 hash of the file being uploaded
options Object <optional>
Optional parameters set on the created file, can be left null
Properties
Name Type Attributes Description
parts Array.<UploadPart> <optional>
The list of uploaded parts to be committed, will be fetched from the API otherwise
description string <optional>
Optional description of the uploaded file.
callback function <optional>
Passed the new file information if successful
Source:
Returns:
A promise resolving to the uploaded file object
Type
Promise.<Object>

copy(fileID, newParentID, optionsopt, callbackopt) → {Promise.<Object>}

Copy a file into a new folder. API Endpoint: '/files/:fileID/copy Method: POST
Parameters:
Name Type Attributes Description
fileID string The Box ID of the file being requested
newParentID string The Box ID for the new parent folder. '0' to copy to All Files.
options Object <optional>
Optional parameters for the copy operation, can be left null in most cases
Properties
Name Type Attributes Description
name string <optional>
A new name to use if there is an identically-named item in the new parent folder
callback function <optional>
passed the new file info if call was successful
Source:
Returns:
A promise resolving to the new file object
Type
Promise.<Object>

copy(fileID, newParentID, optionsopt, callbackopt) → {Promise.<Object>}

Copy a file into a new folder. API Endpoint: '/files/:fileID/copy Method: POST
Parameters:
Name Type Attributes Description
fileID string The Box ID of the file being requested
newParentID string The Box ID for the new parent folder. '0' to copy to All Files.
options Object <optional>
Optional parameters for the copy operation, can be left null in most cases
Properties
Name Type Attributes Description
name string <optional>
A new name to use if there is an identically-named item in the new parent folder
callback function <optional>
passed the new file info if call was successful
Source:
Returns:
A promise resolving to the new file object
Type
Promise.<Object>

createNewVersionUploadSession(fileID, size, callbackopt) → {Promise.<Object>}

Creates a session used to upload a new version of a file in chunks. This will first verify that the version can be created and then open a session for uploading pieces of the file. API Endpoint: '/files/:fileID/upload_sessions' Method: POST
Parameters:
Name Type Attributes Description
fileID string The ID of the file to upload a new version of
size int The size of the file that will be uploaded
callback function <optional>
Passed the upload session info if successful
Source:
Returns:
A promise resolving to the new upload session object
Type
Promise.<Object>

createNewVersionUploadSession(fileID, size, callbackopt) → {Promise.<Object>}

Creates a session used to upload a new version of a file in chunks. This will first verify that the version can be created and then open a session for uploading pieces of the file. API Endpoint: '/files/:fileID/upload_sessions' Method: POST
Parameters:
Name Type Attributes Description
fileID string The ID of the file to upload a new version of
size int The size of the file that will be uploaded
callback function <optional>
Passed the upload session info if successful
Source:
Returns:
A promise resolving to the new upload session object
Type
Promise.<Object>

createUploadSession(folderID, size, name, callbackopt) → {Promise.<Object>}

Creates a session used to upload a new file in chunks.. This will first verify that the file can be created and then open a session for uploading pieces of the file. API Endpoint: '/files/upload_sessions' Method: POST
Parameters:
Name Type Attributes Description
folderID string The ID of the folder to upload the file to
size int The size of the file that will be uploaded
name string The name of the file to be created
callback function <optional>
Passed the upload session info if successful
Source:
Returns:
A promise resolving to the new upload session object
Type
Promise.<Object>

createUploadSession(folderID, size, name, callbackopt) → {Promise.<Object>}

Creates a session used to upload a new file in chunks.. This will first verify that the file can be created and then open a session for uploading pieces of the file. API Endpoint: '/files/upload_sessions' Method: POST
Parameters:
Name Type Attributes Description
folderID string The ID of the folder to upload the file to
size int The size of the file that will be uploaded
name string The name of the file to be created
callback function <optional>
Passed the upload session info if successful
Source:
Returns:
A promise resolving to the new upload session object
Type
Promise.<Object>

createZip(name, items, callbackopt) → {Promise.<string>}

Creates a zip of multiple files and folders. API Endpoint: '/zip_downloads' Method: POST
Parameters:
Name Type Attributes Description
name name The name of the zip file to be created
items Array Array of files or folders to be part of the created zip
callback function <optional>
Passed a zip information object
Source:
Returns:
A promise resolving to a zip information object
Type
Promise.<string>

createZip(name, items, callbackopt) → {Promise.<string>}

Creates a zip of multiple files and folders. API Endpoint: '/zip_downloads' Method: POST
Parameters:
Name Type Attributes Description
name name The name of the zip file to be created
items Array Array of files or folders to be part of the created zip
callback function <optional>
Passed a zip information object
Source:
Returns:
A promise resolving to a zip information object
Type
Promise.<string>

delete(fileID, optionsopt, callbackopt) → {Promise.<void>}

Delete a given file. API Endpoint: '/files/:fileID' Method: DELETE
Parameters:
Name Type Attributes Description
fileID string Box ID of the file being requested
options Object <optional>
Optional parameters
Properties
Name Type Attributes Description
etag string <optional>
Only delete the file if the etag value matches
callback function <optional>
Empty response body passed if successful.
Source:
Returns:
A promise resolving to nothing
Type
Promise.<void>

delete(fileID, optionsopt, callbackopt) → {Promise.<void>}

Delete a given file. API Endpoint: '/files/:fileID' Method: DELETE
Parameters:
Name Type Attributes Description
fileID string Box ID of the file being requested
options Object <optional>
Optional parameters
Properties
Name Type Attributes Description
etag string <optional>
Only delete the file if the etag value matches
callback function <optional>
Empty response body passed if successful.
Source:
Returns:
A promise resolving to nothing
Type
Promise.<void>

deleteMetadata(fileID, scope, template, callbackopt) → {Promise.<void>}

Deletes a metadata template from a file. API Endpoint: '/files/:fileID/metadata/:scope/:template' Method: DELETE
Parameters:
Name Type Attributes Description
fileID string The ID of the file to remove metadata from
scope string The scope of the metadata template
template string The template to remove from the file
callback function <optional>
Called with nothing if successful, error otherwise
Source:
Returns:
A promise resolving to nothing
Type
Promise.<void>

deleteMetadata(fileID, scope, template, callbackopt) → {Promise.<void>}

Deletes a metadata template from a file. API Endpoint: '/files/:fileID/metadata/:scope/:template' Method: DELETE
Parameters:
Name Type Attributes Description
fileID string The ID of the file to remove metadata from
scope string The scope of the metadata template
template string The template to remove from the file
callback function <optional>
Called with nothing if successful, error otherwise
Source:
Returns:
A promise resolving to nothing
Type
Promise.<void>

deletePermanently(fileID, optionsopt, callbackopt) → {Promise.<void>}

Permanently deletes an item that is in the trash. The item will no longer exist in Box. This action cannot be undone. API Endpoint: '/files/:fileID/trash' Method: DELETE
Parameters:
Name Type Attributes Description
fileID string The ID of the file to remove metadata from
options Object <optional>
Optional parameters
Properties
Name Type Attributes Description
etag string <optional>
Only delete the file if the etag matches
callback function <optional>
Called with nothing if successful, error otherwise
Source:
Returns:
A promise resolving to nothing
Type
Promise.<void>

deletePermanently(fileID, optionsopt, callbackopt) → {Promise.<void>}

Permanently deletes an item that is in the trash. The item will no longer exist in Box. This action cannot be undone. API Endpoint: '/files/:fileID/trash' Method: DELETE
Parameters:
Name Type Attributes Description
fileID string The ID of the file to remove metadata from
options Object <optional>
Optional parameters
Properties
Name Type Attributes Description
etag string <optional>
Only delete the file if the etag matches
callback function <optional>
Called with nothing if successful, error otherwise
Source:
Returns:
A promise resolving to nothing
Type
Promise.<void>

deleteVersion(fileID, versionID, optionsopt, callbackopt) → {Promise.<void>}

Discards a specific file version to the trash. Depending on the enterprise settings for this user, the item will either be actually deleted from Box or moved to the trash. API Endpoint: '/files/:fileID/version/:versionID' Method: DELETE
Parameters:
Name Type Attributes Description
fileID string The file ID which old version will be moved to the trash or delete permanently
versionID string The ID of the version to move to the trash or delete permanently
options Object <optional>
Optional parameters
Properties
Name Type Attributes Description
etag string <optional>
Only delete the version of the file etag matches
callback function <optional>
Empty response body, error otherwise
Source:
Returns:
A promise resolving to nothing
Type
Promise.<void>

deleteVersion(fileID, versionID, optionsopt, callbackopt) → {Promise.<void>}

Discards a specific file version to the trash. Depending on the enterprise settings for this user, the item will either be actually deleted from Box or moved to the trash. API Endpoint: '/files/:fileID/version/:versionID' Method: DELETE
Parameters:
Name Type Attributes Description
fileID string The file ID which old version will be moved to the trash or delete permanently
versionID string The ID of the version to move to the trash or delete permanently
options Object <optional>
Optional parameters
Properties
Name Type Attributes Description
etag string <optional>
Only delete the version of the file etag matches
callback function <optional>
Empty response body, error otherwise
Source:
Returns:
A promise resolving to nothing
Type
Promise.<void>

downloadZip(name, items, stream, callbackopt) → {Promise.<Readable>}

Creates a zip of multiple files and folders and downloads it. API Endpoint: '/zip_downloads' Method: GET
Parameters:
Name Type Attributes Description
name name The name of the zip file to be created
items Array Array of files or folders to be part of the created zip
stream Stream Stream to pipe the readable stream of the zip file
callback function <optional>
Passed a zip download status object
Source:
Returns:
A promise resolving to a zip download status object
Type
Promise.<Readable>

downloadZip(name, items, stream, callbackopt) → {Promise.<Readable>}

Creates a zip of multiple files and folders and downloads it. API Endpoint: '/zip_downloads' Method: GET
Parameters:
Name Type Attributes Description
name name The name of the zip file to be created
items Array Array of files or folders to be part of the created zip
stream Stream Stream to pipe the readable stream of the zip file
callback function <optional>
Passed a zip download status object
Source:
Returns:
A promise resolving to a zip download status object
Type
Promise.<Readable>

get(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Requests a file object with the given ID. API Endpoint: '/files/:fileID' Method: GET
Parameters:
Name Type Attributes Description
fileID string Box ID of the file being requested
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Passed the file information if it was acquired successfully
Source:
Returns:
A promise resolving to the file object
Type
Promise.<Object>

get(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Requests a file object with the given ID. API Endpoint: '/files/:fileID' Method: GET
Parameters:
Name Type Attributes Description
fileID string Box ID of the file being requested
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Passed the file information if it was acquired successfully
Source:
Returns:
A promise resolving to the file object
Type
Promise.<Object>

getAllMetadata(fileID, callbackopt) → {Promise.<Object>}

Retrieves all metadata associated with a file. API Endpoint: '/files/:fileID/metadata' Method: GET
Parameters:
Name Type Attributes Description
fileID string the ID of the file to get metadata for
callback function <optional>
called with an array of metadata when successful
Source:
Returns:
A promise resolving to a collection of metadata on the file
Type
Promise.<Object>

getAllMetadata(fileID, callbackopt) → {Promise.<Object>}

Retrieves all metadata associated with a file. API Endpoint: '/files/:fileID/metadata' Method: GET
Parameters:
Name Type Attributes Description
fileID string the ID of the file to get metadata for
callback function <optional>
called with an array of metadata when successful
Source:
Returns:
A promise resolving to a collection of metadata on the file
Type
Promise.<Object>

getChunkedUploader(folderID, size, name, file, optionsopt, callbackopt) → {Promise.<ChunkedUploader>}

Upload a file in chunks, which is generally faster and more reliable for large files. API Endpoint: '/files/upload_sessions' Method: POST
Parameters:
Name Type Attributes Description
folderID string The ID of the folder to upload the file to
size int The size of the file that will be uploaded
name string The name of the file to be created
file Buffer | string | Readable The file to upload
options Object <optional>
Optional parameters for the upload
Properties
Name Type Attributes Description
parallelism int <optional>
The number of chunks to upload concurrently
retryInterval int <optional>
The amount of time to wait before retrying a failed chunk upload, in ms
fileAttributes Object <optional>
Attributes to set on the newly-uploaded file
callback function <optional>
Passed the uploader if successful
Source:
Returns:
A promise resolving to the chunked uploader
Type
Promise.<ChunkedUploader>

getChunkedUploader(folderID, size, name, file, optionsopt, callbackopt) → {Promise.<ChunkedUploader>}

Upload a file in chunks, which is generally faster and more reliable for large files. API Endpoint: '/files/upload_sessions' Method: POST
Parameters:
Name Type Attributes Description
folderID string The ID of the folder to upload the file to
size int The size of the file that will be uploaded
name string The name of the file to be created
file Buffer | string | Readable The file to upload
options Object <optional>
Optional parameters for the upload
Properties
Name Type Attributes Description
parallelism int <optional>
The number of chunks to upload concurrently
retryInterval int <optional>
The amount of time to wait before retrying a failed chunk upload, in ms
fileAttributes Object <optional>
Attributes to set on the newly-uploaded file
callback function <optional>
Passed the uploader if successful
Source:
Returns:
A promise resolving to the chunked uploader
Type
Promise.<ChunkedUploader>

getCollaborations(fileID, optionsopt, callbackopt) → {Promise.<schemas.Collaborations>}

Requests collaborations on a given file. API Endpoint: '/files/:fileID/collaborations' Method: GET
Parameters:
Name Type Attributes Description
fileID string Box ID of the file being requested
options Object <optional>
Additional options. Can be left null in most cases.
Properties
Name Type Attributes Description
limit int <optional>
The maximum number of collaborations to return
offset int <optional>
Paging parameter for the collaborations collection
fields string <optional>
Comma-separated list of fields to return on the collaboration objects
callback function <optional>
Passed the collaborations if successful, error otherwise
Source:
Returns:
A promise resolving to the collection of collaborations on the file
Type
Promise.<schemas.Collaborations>

getCollaborations(fileID, optionsopt, callbackopt) → {Promise.<schemas.Collaborations>}

Requests collaborations on a given file. API Endpoint: '/files/:fileID/collaborations' Method: GET
Parameters:
Name Type Attributes Description
fileID string Box ID of the file being requested
options Object <optional>
Additional options. Can be left null in most cases.
Properties
Name Type Attributes Description
limit int <optional>
The maximum number of collaborations to return
offset int <optional>
Paging parameter for the collaborations collection
fields string <optional>
Comma-separated list of fields to return on the collaboration objects
callback function <optional>
Passed the collaborations if successful, error otherwise
Source:
Returns:
A promise resolving to the collection of collaborations on the file
Type
Promise.<schemas.Collaborations>

getComments(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Gets the comments on a file. API Endpoint: '/files/:fileID/comments' Method: GET
Parameters:
Name Type Attributes Description
fileID string Box file id of the file
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
passed the file comments if they were successfully acquired
Source:
Returns:
A promise resolving to the collection of comments
Type
Promise.<Object>

getComments(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Gets the comments on a file. API Endpoint: '/files/:fileID/comments' Method: GET
Parameters:
Name Type Attributes Description
fileID string Box file id of the file
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
passed the file comments if they were successfully acquired
Source:
Returns:
A promise resolving to the collection of comments
Type
Promise.<Object>

getDownloadURL(fileID, optionsopt, callbackopt) → {Promise.<string>}

Requests a download URL for a given file. API Endpoint: '/files/:fileID/content' Method: GET Special Expected Responses: 202 ACCEPTED - Download isn't available yet. Returns an error. 302 FOUND - Download is available. A Download URL is returned.
Parameters:
Name Type Attributes Description
fileID string Box ID of the file being requested
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Passed the download URL if request was successful.
Source:
Returns:
A promise resolving to the file's download URL
Type
Promise.<string>

getDownloadURL(fileID, optionsopt, callbackopt) → {Promise.<string>}

Requests a download URL for a given file. API Endpoint: '/files/:fileID/content' Method: GET Special Expected Responses: 202 ACCEPTED - Download isn't available yet. Returns an error. 302 FOUND - Download is available. A Download URL is returned.
Parameters:
Name Type Attributes Description
fileID string Box ID of the file being requested
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Passed the download URL if request was successful.
Source:
Returns:
A promise resolving to the file's download URL
Type
Promise.<string>
Used to retrieve an expiring URL for creating an embedded preview session. The URL will expire after 60 seconds and the preview session will expire after 60 minutes. API Endpoint: '/files/:fileID?fields=expiring_embed_link' Method: GET
Parameters:
Name Type Attributes Description
fileID string The ID of the file to generate embed link for
callback function <optional>
Passed with the embed link if successful, error otherwise
Source:
Returns:
A promise resolving to the file embed link URL
Type
Promise.<string>
Used to retrieve an expiring URL for creating an embedded preview session. The URL will expire after 60 seconds and the preview session will expire after 60 minutes. API Endpoint: '/files/:fileID?fields=expiring_embed_link' Method: GET
Parameters:
Name Type Attributes Description
fileID string The ID of the file to generate embed link for
callback function <optional>
Passed with the embed link if successful, error otherwise
Source:
Returns:
A promise resolving to the file embed link URL
Type
Promise.<string>

getMetadata(fileID, scope, template, callbackopt) → {Promise.<Object>}

Retrieve a single metadata template instance for a file. API Endpoint: '/files/:fileID/metadata/:scope/:template' Method: GET
Parameters:
Name Type Attributes Description
fileID string The ID of the file to retrive the metadata of
scope string The scope of the metadata template, e.g. "global"
template string The metadata template to retrieve
callback function <optional>
Passed the metadata template if successful
Source:
Returns:
A promise resolving to the metadata template
Type
Promise.<Object>

getMetadata(fileID, scope, template, callbackopt) → {Promise.<Object>}

Retrieve a single metadata template instance for a file. API Endpoint: '/files/:fileID/metadata/:scope/:template' Method: GET
Parameters:
Name Type Attributes Description
fileID string The ID of the file to retrive the metadata of
scope string The scope of the metadata template, e.g. "global"
template string The metadata template to retrieve
callback function <optional>
Passed the metadata template if successful
Source:
Returns:
A promise resolving to the metadata template
Type
Promise.<Object>

getNewVersionChunkedUploader(fileID, size, file, optionsopt, callbackopt) → {Promise.<ChunkedUploader>}

Upload a new file version in chunks, which is generally faster and more reliable for large files. API Endpoint: '/files/:fileID/upload_sessions' Method: POST
Parameters:
Name Type Attributes Description
fileID string The ID of the file to upload a new version of
size int The size of the file that will be uploaded
file Buffer | string | Readable The file to upload
options Object <optional>
Optional parameters for the upload
Properties
Name Type Attributes Description
parallelism int <optional>
The number of chunks to upload concurrently
retryInterval int <optional>
The amount of time to wait before retrying a failed chunk upload, in ms
fileAttributes Object <optional>
Attributes to set on the updated file object
callback function <optional>
Passed the uploader if successful
Source:
Returns:
A promise resolving to the chunked uploader
Type
Promise.<ChunkedUploader>

getNewVersionChunkedUploader(fileID, size, file, optionsopt, callbackopt) → {Promise.<ChunkedUploader>}

Upload a new file version in chunks, which is generally faster and more reliable for large files. API Endpoint: '/files/:fileID/upload_sessions' Method: POST
Parameters:
Name Type Attributes Description
fileID string The ID of the file to upload a new version of
size int The size of the file that will be uploaded
file Buffer | string | Readable The file to upload
options Object <optional>
Optional parameters for the upload
Properties
Name Type Attributes Description
parallelism int <optional>
The number of chunks to upload concurrently
retryInterval int <optional>
The amount of time to wait before retrying a failed chunk upload, in ms
fileAttributes Object <optional>
Attributes to set on the updated file object
callback function <optional>
Passed the uploader if successful
Source:
Returns:
A promise resolving to the chunked uploader
Type
Promise.<ChunkedUploader>

getReadStream(fileID, optionsopt, callbackopt) → {Promise.<Readable>}

Requests a Readable Stream for the given file ID. API Endpoint: '/files/:fileID/content' Method: GET Special Expected Responses: 202 ACCEPTED - Download isn't available yet. Returns an error. 302 FOUND - Download is available. A Download stream is returned.
Parameters:
Name Type Attributes Description
fileID string Box ID of the file being requested
options Object <optional>
Additional options for the request. Can be left null in most cases.
Properties
Name Type Attributes Description
version string <optional>
ID of the version of this file to download
byteRange Array.<int> <optional>
starting and ending bytes of the file to read, e.g. [0, 99] to read the first 100 bytes
callback function <optional>
passed the readable stream if request was successful
Source:
Returns:
A promise resolving for the file stream
Type
Promise.<Readable>

getReadStream(fileID, optionsopt, callbackopt) → {Promise.<Readable>}

Requests a Readable Stream for the given file ID. API Endpoint: '/files/:fileID/content' Method: GET Special Expected Responses: 202 ACCEPTED - Download isn't available yet. Returns an error. 302 FOUND - Download is available. A Download stream is returned.
Parameters:
Name Type Attributes Description
fileID string Box ID of the file being requested
options Object <optional>
Additional options for the request. Can be left null in most cases.
Properties
Name Type Attributes Description
version string <optional>
ID of the version of this file to download
byteRange Array.<int> <optional>
starting and ending bytes of the file to read, e.g. [0, 99] to read the first 100 bytes
callback function <optional>
passed the readable stream if request was successful
Source:
Returns:
A promise resolving for the file stream
Type
Promise.<Readable>

getRepresentationContent(fileID, representationType, optionsopt, callbackopt) → {Promise.<Readable>}

Get the contents of a representation of a file, e.g, the binary content of an image or pdf. API Endpoint: '/files/:fileID?fields=representations' Method : GET
Parameters:
Name Type Attributes Description
fileID string The file ID to get the representation of
representationType string The X-Rep-Hints type to request
options Object <optional>
Optional parameters
Properties
Name Type Attributes Description
assetPath string <optional>
Asset path for representations with multiple files
callback function <optional>
Passed a stream over the representation contents if successful
Source:
Returns:
A promise resolving to a stream over the representation contents
Type
Promise.<Readable>

getRepresentationContent(fileID, representationType, optionsopt, callbackopt) → {Promise.<Readable>}

Get the contents of a representation of a file, e.g, the binary content of an image or pdf. API Endpoint: '/files/:fileID?fields=representations' Method : GET
Parameters:
Name Type Attributes Description
fileID string The file ID to get the representation of
representationType string The X-Rep-Hints type to request
options Object <optional>
Optional parameters
Properties
Name Type Attributes Description
assetPath string <optional>
Asset path for representations with multiple files
callback function <optional>
Passed a stream over the representation contents if successful
Source:
Returns:
A promise resolving to a stream over the representation contents
Type
Promise.<Readable>

getRepresentationInfo(fileID, representationType, optionsopt, callbackopt) → {Promise.<Object>}

Requests information for all representation objects generated for a specific Box file API Endpoint: '/files/:fileID?fields=representations' Method : GET
Parameters:
Name Type Attributes Description
fileID string Box ID of the file being requested
representationType client.files.representation The x-rep-hints value the application should create a representation for. This value can either come from FileRepresentationType enum or manually created
options Object <optional>
Additional options. Can be left empty
Properties
Name Type Attributes Default Description
generateRepresentations boolean <optional>
false Set to true to return representation info where all states resolve to success.
callback function <optional>
Passed an array of representaton objects if successful
Source:
Returns:
A promise resolving to the representation response objects
Type
Promise.<Object>

getRepresentationInfo(fileID, representationType, optionsopt, callbackopt) → {Promise.<Object>}

Requests information for all representation objects generated for a specific Box file API Endpoint: '/files/:fileID?fields=representations' Method : GET
Parameters:
Name Type Attributes Description
fileID string Box ID of the file being requested
representationType client.files.representation The x-rep-hints value the application should create a representation for. This value can either come from FileRepresentationType enum or manually created
options Object <optional>
Additional options. Can be left empty
Properties
Name Type Attributes Default Description
generateRepresentations boolean <optional>
false Set to true to return representation info where all states resolve to success.
callback function <optional>
Passed an array of representaton objects if successful
Source:
Returns:
A promise resolving to the representation response objects
Type
Promise.<Object>

getTasks(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Retrieves all of the tasks for given file. API Endpoint: '/files/:fileID/tasks' Method: GET
Parameters:
Name Type Attributes Description
fileID string The ID of the file to get tasks for
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Passed the file tasks if successful, error otherwise
Source:
Returns:
A promise resolving to a collections of tasks on the file
Type
Promise.<Object>

getTasks(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Retrieves all of the tasks for given file. API Endpoint: '/files/:fileID/tasks' Method: GET
Parameters:
Name Type Attributes Description
fileID string The ID of the file to get tasks for
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Passed the file tasks if successful, error otherwise
Source:
Returns:
A promise resolving to a collections of tasks on the file
Type
Promise.<Object>

getTrashedFile(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Retrieves a file that has been moved to the trash. API Endpoint: '/files/:fileID/trash' Method: GET
Parameters:
Name Type Attributes Description
fileID string The ID of the file being requested
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Passed the trashed file information if successful, error otherwise
Source:
Returns:
A promise resolving to the trashed file
Type
Promise.<Object>

getTrashedFile(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Retrieves a file that has been moved to the trash. API Endpoint: '/files/:fileID/trash' Method: GET
Parameters:
Name Type Attributes Description
fileID string The ID of the file being requested
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Passed the trashed file information if successful, error otherwise
Source:
Returns:
A promise resolving to the trashed file
Type
Promise.<Object>

getUploadSession(sessionID, callbackopt) → {Promise.<Object>}

Get the status of an upload session, e.g. whether or not is has started or finished committing API Endpoint: '/files/upload_sessions/:sessionID' Method: GET
Parameters:
Name Type Attributes Description
sessionID string The ID of the upload session to get the status of
callback function <optional>
Passed the session status if successful
Source:
Returns:
A promise resolving to the upload session object
Type
Promise.<Object>

getUploadSession(sessionID, callbackopt) → {Promise.<Object>}

Get the status of an upload session, e.g. whether or not is has started or finished committing API Endpoint: '/files/upload_sessions/:sessionID' Method: GET
Parameters:
Name Type Attributes Description
sessionID string The ID of the upload session to get the status of
callback function <optional>
Passed the session status if successful
Source:
Returns:
A promise resolving to the upload session object
Type
Promise.<Object>

getUploadSessionParts(sessionID, optionsopt, callbackopt) → {Promise.<Object>}

Get a list of all parts that have been uploaded to an upload session API Endpoint: '/files/upload_sessions/:sessionID/parts' Method: GET
Parameters:
Name Type Attributes Description
sessionID string The ID of the session to get a list of parts from
options Object <optional>
Optional parameters, can be left null
Properties
Name Type Attributes Description
offset string <optional>
Paging offset for the list of parts
limit int <optional>
Maximum number of parts to return
callback function <optional>
Passed the list of parts if successful
Source:
Returns:
A promise resolving to the collection of uploaded parts
Type
Promise.<Object>

getUploadSessionParts(sessionID, optionsopt, callbackopt) → {Promise.<Object>}

Get a list of all parts that have been uploaded to an upload session API Endpoint: '/files/upload_sessions/:sessionID/parts' Method: GET
Parameters:
Name Type Attributes Description
sessionID string The ID of the session to get a list of parts from
options Object <optional>
Optional parameters, can be left null
Properties
Name Type Attributes Description
offset string <optional>
Paging offset for the list of parts
limit int <optional>
Maximum number of parts to return
callback function <optional>
Passed the list of parts if successful
Source:
Returns:
A promise resolving to the collection of uploaded parts
Type
Promise.<Object>

getVersions(fileID, optionsopt, callbackopt) → {Promise.<Object>}

If there are previous versions of this file, this method can be used to retrieve information about the older versions. API Endpoint: '/files/:fileID/versions' Method: GET
Parameters:
Name Type Attributes Description
fileID string The ID of the file to view version for
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Passed a list of previous file versions if successful, error otherwise
Source:
Returns:
A promise resolving to the collection of file versions
Type
Promise.<Object>

getVersions(fileID, optionsopt, callbackopt) → {Promise.<Object>}

If there are previous versions of this file, this method can be used to retrieve information about the older versions. API Endpoint: '/files/:fileID/versions' Method: GET
Parameters:
Name Type Attributes Description
fileID string The ID of the file to view version for
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Passed a list of previous file versions if successful, error otherwise
Source:
Returns:
A promise resolving to the collection of file versions
Type
Promise.<Object>

getWatermark(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Used to retrieve the watermark for a corresponding Box file. API Endpoint: '/files/:fileID/watermark' Method: GET
Parameters:
Name Type Attributes Description
fileID string The Box ID of the file to get watermark for
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Passed the watermark information if successful, error otherwise
Source:
Returns:
A promise resolving to the watermark info
Type
Promise.<Object>

getWatermark(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Used to retrieve the watermark for a corresponding Box file. API Endpoint: '/files/:fileID/watermark' Method: GET
Parameters:
Name Type Attributes Description
fileID string The Box ID of the file to get watermark for
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Passed the watermark information if successful, error otherwise
Source:
Returns:
A promise resolving to the watermark info
Type
Promise.<Object>

lock(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Locks a file. API Endpoint: '/files/:fileID' Method: PUT
Parameters:
Name Type Attributes Description
fileID string The ID of the file to lock
options Object <optional>
Optional parameters, can be left null in most cases
Properties
Name Type Attributes Description
expires_at string <optional>
<nullable>
The time the lock expires
is_download_prevented boolean <optional>
Whether or not the file can be downloaded while locked
callback function <optional>
Passed with the locked file information if successful, error otherwise
Source:
Returns:
A promise resolving to the locked file object
Type
Promise.<Object>

lock(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Locks a file. API Endpoint: '/files/:fileID' Method: PUT
Parameters:
Name Type Attributes Description
fileID string The ID of the file to lock
options Object <optional>
Optional parameters, can be left null in most cases
Properties
Name Type Attributes Description
expires_at string <optional>
<nullable>
The time the lock expires
is_download_prevented boolean <optional>
Whether or not the file can be downloaded while locked
callback function <optional>
Passed with the locked file information if successful, error otherwise
Source:
Returns:
A promise resolving to the locked file object
Type
Promise.<Object>

move(fileID, newParentID, callbackopt) → {Promise.<Object>}

Move a file into a new parent folder. API Endpoint: '/files/:fileID' Method: PUT
Parameters:
Name Type Attributes Description
fileID string The Box ID of the file being requested
newParentID string The Box ID for the new parent folder. '0' to move to All Files.
callback function <optional>
Passed the updated file information if it was acquired successfully
Source:
Returns:
A promise resolving to the updated file object
Type
Promise.<Object>

move(fileID, newParentID, callbackopt) → {Promise.<Object>}

Move a file into a new parent folder. API Endpoint: '/files/:fileID' Method: PUT
Parameters:
Name Type Attributes Description
fileID string The Box ID of the file being requested
newParentID string The Box ID for the new parent folder. '0' to move to All Files.
callback function <optional>
Passed the updated file information if it was acquired successfully
Source:
Returns:
A promise resolving to the updated file object
Type
Promise.<Object>

preflightUploadFile(parentFolderID, fileDataopt, optionsopt, callbackopt) → {Promise.<Object>}

Get preflight information for a new file upload. Without any file data, this will return an upload URL and token to be used when uploading the file. Using this upload URL will allow for the fastest upload, and the one-time token can be passed to a worker or other client to actually perform the upload with. If file data (e.g. size, parent, name) is passed, it will be validated as if the actual file were being uploaded. This enables checking of preconditions such as name uniqueness and available storage space before attempting a large file upload. API Endpoint: '/files/content' Method: OPTIONS
Parameters:
Name Type Attributes Description
parentFolderID string The id of the parent folder to upload to
fileData Object <optional>
Optional data about the file to be uploaded
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Called with upload data if successful, or err if the upload would not succeed
Source:
Returns:
A promise resolving to the upload data
Type
Promise.<Object>

preflightUploadFile(parentFolderID, fileDataopt, optionsopt, callbackopt) → {Promise.<Object>}

Get preflight information for a new file upload. Without any file data, this will return an upload URL and token to be used when uploading the file. Using this upload URL will allow for the fastest upload, and the one-time token can be passed to a worker or other client to actually perform the upload with. If file data (e.g. size, parent, name) is passed, it will be validated as if the actual file were being uploaded. This enables checking of preconditions such as name uniqueness and available storage space before attempting a large file upload. API Endpoint: '/files/content' Method: OPTIONS
Parameters:
Name Type Attributes Description
parentFolderID string The id of the parent folder to upload to
fileData Object <optional>
Optional data about the file to be uploaded
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Called with upload data if successful, or err if the upload would not succeed
Source:
Returns:
A promise resolving to the upload data
Type
Promise.<Object>

preflightUploadNewFileVersion(fileID, fileDataopt, optionsopt, callbackopt) → {Promise.<Object>}

Get preflight information for a file version upload. Without any file data, this will return an upload URL and token to be used when uploading the file. Using this upload URL will allow for the fastest upload, and the one-time token can be passed to a worker or other client to actually perform the upload with. If file data (e.g. size, parent, name) is passed, it will be validated as if the actual file were being uploaded. This enables checking of preconditions such as name uniqueness and available storage space before attempting a large file upload. API Endpoint: '/files/:fileID/content' Method: OPTIONS
Parameters:
Name Type Attributes Description
fileID string The file ID to which a new version will be uploaded
fileData Object <optional>
Optional data about the file to be uploaded
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Called with upload data if successful, or err if the upload would not succeed
Source:
Returns:
A promise resolving to the upload data
Type
Promise.<Object>

preflightUploadNewFileVersion(fileID, fileDataopt, optionsopt, callbackopt) → {Promise.<Object>}

Get preflight information for a file version upload. Without any file data, this will return an upload URL and token to be used when uploading the file. Using this upload URL will allow for the fastest upload, and the one-time token can be passed to a worker or other client to actually perform the upload with. If file data (e.g. size, parent, name) is passed, it will be validated as if the actual file were being uploaded. This enables checking of preconditions such as name uniqueness and available storage space before attempting a large file upload. API Endpoint: '/files/:fileID/content' Method: OPTIONS
Parameters:
Name Type Attributes Description
fileID string The file ID to which a new version will be uploaded
fileData Object <optional>
Optional data about the file to be uploaded
options Object <optional>
Additional options for the request. Can be left null in most cases.
callback function <optional>
Called with upload data if successful, or err if the upload would not succeed
Source:
Returns:
A promise resolving to the upload data
Type
Promise.<Object>

promoteVersion(fileID, versionID, callbackopt) → {Promise.<Object>}

If there are previous versions of this file, this method can be used to promote one of the older versions to the top of the stack. This actually mints a copy of the old version and puts it on the top of the versions stack. The file will have the exact same contents, the same SHA1/etag, and the same name as the original. Other properties such as comments do not get updated to their former values. API Endpoint: '/files/:fileID/versions/current' Method: POST
Parameters:
Name Type Attributes Description
fileID string The file ID which version will be promoted
versionID string The ID of the file_version that you want to make current
callback function <optional>
Passed the promoted file version information if successful, error otherwise
Source:
Returns:
A promise resolving to the promoted file version
Type
Promise.<Object>

promoteVersion(fileID, versionID, callbackopt) → {Promise.<Object>}

If there are previous versions of this file, this method can be used to promote one of the older versions to the top of the stack. This actually mints a copy of the old version and puts it on the top of the versions stack. The file will have the exact same contents, the same SHA1/etag, and the same name as the original. Other properties such as comments do not get updated to their former values. API Endpoint: '/files/:fileID/versions/current' Method: POST
Parameters:
Name Type Attributes Description
fileID string The file ID which version will be promoted
versionID string The ID of the file_version that you want to make current
callback function <optional>
Passed the promoted file version information if successful, error otherwise
Source:
Returns:
A promise resolving to the promoted file version
Type
Promise.<Object>

removeFromCollection(fileID, collectionID, callbackopt) → {Promise.<Object>}

Remove a file from a given collection API Endpoint: '/files/:fileID' Method: PUT
Parameters:
Name Type Attributes Description
fileID string The file to remove from the collection
collectionID string The collection to remove the file from
callback function <optional>
Passed the updated file if successful, error otherwise
Source:
Returns:
A promise resolving to the updated file object
Type
Promise.<Object>

removeFromCollection(fileID, collectionID, callbackopt) → {Promise.<Object>}

Remove a file from a given collection API Endpoint: '/files/:fileID' Method: PUT
Parameters:
Name Type Attributes Description
fileID string The file to remove from the collection
collectionID string The collection to remove the file from
callback function <optional>
Passed the updated file if successful, error otherwise
Source:
Returns:
A promise resolving to the updated file object
Type
Promise.<Object>

removeWatermark(fileID, callbackopt) → {Promise.<void>}

Used to remove the watermark for a corresponding Box file. API Endpoint: '/files/:fileID/watermark' Method: DELETE
Parameters:
Name Type Attributes Description
fileID string The Box ID of the file to remove watermark from
callback function <optional>
Empty response body passed if successful, error otherwise
Source:
Returns:
A promise resolving to nothing
Type
Promise.<void>

removeWatermark(fileID, callbackopt) → {Promise.<void>}

Used to remove the watermark for a corresponding Box file. API Endpoint: '/files/:fileID/watermark' Method: DELETE
Parameters:
Name Type Attributes Description
fileID string The Box ID of the file to remove watermark from
callback function <optional>
Empty response body passed if successful, error otherwise
Source:
Returns:
A promise resolving to nothing
Type
Promise.<void>

restoreFromTrash(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Restores an item that has been moved to the trash. Default behavior is to restore the item to the folder it was in before it was moved to the trash. If that parent folder no longer exists or if there is now an item with the same name in that parent folder, the new parent folder and/or new name will need to be included in the request. API Endpoint: '/files/:fileID' Method: POST
Parameters:
Name Type Attributes Description
fileID string The ID of the file to restore
options Object <optional>
Optional parameters, can be left null in most cases
Properties
Name Type Attributes Description
name string <optional>
The new name for this item
parent_id string <optional>
The new parent folder for this item
callback function <optional>
Called with item information if successful, error otherwise
Source:
Returns:
A promise resolving to the restored file object
Type
Promise.<Object>

restoreFromTrash(fileID, optionsopt, callbackopt) → {Promise.<Object>}

Restores an item that has been moved to the trash. Default behavior is to restore the item to the folder it was in before it was moved to the trash. If that parent folder no longer exists or if there is now an item with the same name in that parent folder, the new parent folder and/or new name will need to be included in the request. API Endpoint: '/files/:fileID' Method: POST
Parameters:
Name Type Attributes Description
fileID string The ID of the file to restore
options Object <optional>
Optional parameters, can be left null in most cases
Properties
Name Type Attributes Description
name string <optional>
The new name for this item
parent_id string <optional>
The new parent folder for this item
callback function <optional>
Called with item information if successful, error otherwise
Source:
Returns:
A promise resolving to the restored file object
Type
Promise.<Object>

setMetadata(fileID, scope, template, metadata, callbackopt) → {Promise.<Object>}

Sets metadata on a file, overwriting any metadata that exists for the provided keys.
Parameters:
Name Type Attributes Description
fileID string The file to set metadata on
scope string The scope of the metadata template
template string The key of the metadata template
metadata Object The metadata to set
callback function <optional>
Called with updated metadata if successful
Source:
Returns:
A promise resolving to the updated metadata
Type
Promise.<Object>

setMetadata(fileID, scope, template, metadata, callbackopt) → {Promise.<Object>}

Sets metadata on a file, overwriting any metadata that exists for the provided keys.
Parameters:
Name Type Attributes Description
fileID string The file to set metadata on
scope string The scope of the metadata template
template string The key of the metadata template
metadata Object The metadata to set
callback function <optional>
Called with updated metadata if successful
Source:
Returns:
A promise resolving to the updated metadata
Type
Promise.<Object>

unlock(fileID, callbackopt) → {Promise.<Object>}

Unlocks a file. API Endpoint: '/files/:fileID' Method: PUT
Parameters:
Name Type Attributes Description
fileID string The ID of the file to unlock
callback function <optional>
Passed with the unlocked file information if successful, error otherwise
Source:
Returns:
A promise resolving to the unlocked file object
Type
Promise.<Object>

unlock(fileID, callbackopt) → {Promise.<Object>}

Unlocks a file. API Endpoint: '/files/:fileID' Method: PUT
Parameters:
Name Type Attributes Description
fileID string The ID of the file to unlock
callback function <optional>
Passed with the unlocked file information if successful, error otherwise
Source:
Returns:
A promise resolving to the unlocked file object
Type
Promise.<Object>

update(fileID, updates, callbackopt) → {Promise.<Object>}

Update some information about a given file. API Endpoint: '/files/:fileID' Method: PUT
Parameters:
Name Type Attributes Description
fileID string Box ID of the file being requested
updates Object File fields to update
Properties
Name Type Attributes Description
etag string <optional>
Only apply the updates if the file etag matches
fields string <optional>
Comma-separated list of fields to return
callback function <optional>
Passed the updated file information if it was acquired successfully
Source:
Returns:
A promise resolving to the update file object
Type
Promise.<Object>

update(fileID, updates, callbackopt) → {Promise.<Object>}

Update some information about a given file. API Endpoint: '/files/:fileID' Method: PUT
Parameters:
Name Type Attributes Description
fileID string Box ID of the file being requested
updates Object File fields to update
Properties
Name Type Attributes Description
etag string <optional>
Only apply the updates if the file etag matches
fields string <optional>
Comma-separated list of fields to return
callback function <optional>
Passed the updated file information if it was acquired successfully
Source:
Returns:
A promise resolving to the update file object
Type
Promise.<Object>

updateMetadata(fileID, scope, template, patch, callbackopt) → {Promise.<Object>}

Updates a metadata template instance with JSON Patch-formatted data. API Endpoint: '/files/:fileID/metadata/:scope/:template' Method: PUT
Parameters:
Name Type Attributes Description
fileID string The file to update metadata for
scope string The scope of the template to update
template string The template to update
patch Object The patch data
callback function <optional>
Called with updated metadata if successful
Source:
Returns:
A promise resolving to the updated metadata
Type
Promise.<Object>

updateMetadata(fileID, scope, template, patch, callbackopt) → {Promise.<Object>}

Updates a metadata template instance with JSON Patch-formatted data. API Endpoint: '/files/:fileID/metadata/:scope/:template' Method: PUT
Parameters:
Name Type Attributes Description
fileID string The file to update metadata for
scope string The scope of the template to update
template string The template to update
patch Object The patch data
callback function <optional>
Called with updated metadata if successful
Source:
Returns:
A promise resolving to the updated metadata
Type
Promise.<Object>

uploadFile(parentFolderID, filename, content, optionsopt, callbackopt) → {Promise.<Object>}

Uploads a new file. Unlike non-upload methods, this method will not perform any retries. This method currently does not support any optional parameters such as contentModifiedAt. API Endpoint: '/files/content' Method: POST
Parameters:
Name Type Attributes Description
parentFolderID string the id of the parent folder to upload to
filename string the file name that the uploaded file should have
content string | Buffer | ReadStream the content of the file. It can be a string, a Buffer, or a read stream (like that returned by fs.createReadStream()).
options Object <optional>
Optional parameters
Properties
Name Type Attributes Description
content_created_at string <optional>
RFC 3339 timestamp when the file was created
content_modified_at string <optional>
RFC 3339 timestamp when the file was last modified
content_length int <optional>
Optional length of the content. Required if content is a read stream of any type other than fs stream.
description string <optional>
Optional description of the uploaded file.
callback function <optional>
called with data about the upload if successful, or an error if the upload failed
Source:
Returns:
A promise resolving to the uploaded file
Type
Promise.<Object>

uploadFile(parentFolderID, filename, content, optionsopt, callbackopt) → {Promise.<Object>}

Uploads a new file. Unlike non-upload methods, this method will not perform any retries. This method currently does not support any optional parameters such as contentModifiedAt. API Endpoint: '/files/content' Method: POST
Parameters:
Name Type Attributes Description
parentFolderID string the id of the parent folder to upload to
filename string the file name that the uploaded file should have
content string | Buffer | ReadStream the content of the file. It can be a string, a Buffer, or a read stream (like that returned by fs.createReadStream()).
options Object <optional>
Optional parameters
Properties
Name Type Attributes Description
content_created_at string <optional>
RFC 3339 timestamp when the file was created
content_modified_at string <optional>
RFC 3339 timestamp when the file was last modified
content_length int <optional>
Optional length of the content. Required if content is a read stream of any type other than fs stream.
description string <optional>
Optional description of the uploaded file.
callback function <optional>
called with data about the upload if successful, or an error if the upload failed
Source:
Returns:
A promise resolving to the uploaded file
Type
Promise.<Object>

uploadNewFileVersion(fileID, content, optionsopt, callbackopt) → {Promise.<Object>}

Uploads a new version of a file. Unlike non-upload methods, this method will not perform any retries. This method currently does not support any optional parameters such as contentModifiedAt. API Endpoint: '/files/:fileID/content' Method: POST
Parameters:
Name Type Attributes Description
fileID string the id of the file to upload a new version of
content string | Buffer | Stream the content of the file. It can be a string, a Buffer, or a read stream (like that returned by fs.createReadStream()).
options Object <optional>
Optional parameters
Properties
Name Type Attributes Description
content_modified_at string <optional>
RFC 3339 timestamp when the file was last modified
name string <optional>
A new name for the file
content_length int <optional>
Optional length of the content. Required if content is a read stream of any type other than fs stream.
description string <optional>
Optional description of the uploaded new file version.
callback function <optional>
called with data about the upload if successful, or an error if the upload failed
Source:
Returns:
A promise resolving to the uploaded file
Type
Promise.<Object>

uploadNewFileVersion(fileID, content, optionsopt, callbackopt) → {Promise.<Object>}

Uploads a new version of a file. Unlike non-upload methods, this method will not perform any retries. This method currently does not support any optional parameters such as contentModifiedAt. API Endpoint: '/files/:fileID/content' Method: POST
Parameters:
Name Type Attributes Description
fileID string the id of the file to upload a new version of
content string | Buffer | Stream the content of the file. It can be a string, a Buffer, or a read stream (like that returned by fs.createReadStream()).
options Object <optional>
Optional parameters
Properties
Name Type Attributes Description
content_modified_at string <optional>
RFC 3339 timestamp when the file was last modified
name string <optional>
A new name for the file
content_length int <optional>
Optional length of the content. Required if content is a read stream of any type other than fs stream.
description string <optional>
Optional description of the uploaded new file version.
callback function <optional>
called with data about the upload if successful, or an error if the upload failed
Source:
Returns:
A promise resolving to the uploaded file
Type
Promise.<Object>

uploadPart(sessionID, part, offset, totalSize, callbackopt) → {Promise.<Object>}

Uploads a chunk of a file to an open upload session API Endpoint: '/files/upload_sessions/:sessionID' Method: PUT
Parameters:
Name Type Attributes Description
sessionID string The ID of the upload session to upload to
part Buffer | string The chunk of the file to upload
offset int The byte position where the chunk begins in the file
totalSize int The total size of the file being uploaded
callback function <optional>
Passed the part definition if successful
Source:
Returns:
A promise resolving to the part object
Type
Promise.<Object>

uploadPart(sessionID, part, offset, totalSize, callbackopt) → {Promise.<Object>}

Uploads a chunk of a file to an open upload session API Endpoint: '/files/upload_sessions/:sessionID' Method: PUT
Parameters:
Name Type Attributes Description
sessionID string The ID of the upload session to upload to
part Buffer | string The chunk of the file to upload
offset int The byte position where the chunk begins in the file
totalSize int The total size of the file being uploaded
callback function <optional>
Passed the part definition if successful
Source:
Returns:
A promise resolving to the part object
Type
Promise.<Object>