Files + Parts
Methods for accessing and managing access groups
ContentPart
libraryId, // optional
objectId, // optional
versionHash, // optional
partHash
}) → Promise.<Object>
Get information on a specific part
Returns: Response containing information about the specified part
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
libraryId | string | ID of the library | |
objectId | string | ID of the object | |
versionHash | string | Hash of the object version - if not specified, latest version will be used | |
partHash | string | ✓ | Hash of the part to retrieve |
ContentParts
libraryId, // optional
objectId, // optional
versionHash // optional
}) → Promise.<Object>
List content object parts
Returns: Response containing list of parts of the object
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
libraryId | string | ID of the library | |
objectId | string | ID of the object | |
versionHash | string | Hash of the object version - if not specified, latest version will be used |
CreateFileDirectories
libraryId,
objectId,
writeToken,
filePaths
})
Create the specified directories on the specified object
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
libraryId | string | ✓ | ID of the library |
objectId | string | ✓ | ID of the object |
writeToken | string | ✓ | Write token of the draft |
filePaths | Array.<string> | ✓ | List of file paths to create |
CreatePart
libraryId,
objectId,
writeToken,
encryption // optional
}) → Promise.<string>
Create a part upload draft
Returns: The part write token for the part draft
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
libraryId | string | ✓ | ID of the library |
objectId | string | ✓ | ID of the object |
writeToken | string | ✓ | Write token of the content object draft |
encryption | string | Desired encryption scheme. Options: 'none' (default), 'cgck' (default:none) |
DeleteFiles
libraryId,
objectId,
writeToken,
filePaths
})
Delete the specified list of files/directories
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
libraryId | string | ✓ | ID of the library |
objectId | string | ✓ | ID of the object |
writeToken | string | ✓ | Write token of the draft |
filePaths | Array.<string> | ✓ | List of file paths to delete |
DeletePart
libraryId,
objectId,
writeToken,
partHash
})
Delete the specified part from a content draft
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
libraryId | string | ✓ | ID of the library |
objectId | string | ✓ | ID of the object |
writeToken | string | ✓ | Write token of the content object draft |
partHash | string | ✓ | Hash of the part to delete |
DownloadFile
libraryId, // optional
objectId, // optional
versionHash, // optional
writeToken, // optional
filePath,
format, // optional
chunked, // optional
chunkSize, // optional
clientSideDecryption, // optional
callback // optional
}) → Promise.<ArrayBuffer> | undefined
Download a file from a content object
Returns: No return if chunked is specified, file data in the requested format otherwise
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
libraryId | string | ID of the library | |
objectId | string | ID of the object | |
versionHash | string | Hash of the object version - if not specified, latest version will be used | |
writeToken | string | Write token for the draft from which to download the file | |
filePath | string | ✓ | Path to the file to download |
format | string | Format in which to return the data ("blob" | "arraybuffer" | "buffer") (default:"arrayBuffer") | |
chunked | boolean | If specified, file will be downloaded and decrypted in chunks. The specified callback will be invoked on completion of each chunk. This is recommended for large files. (default:false) | |
chunkSize | number | Size of file chunks to request for download
1000000) | |
clientSideDecryption | boolean | If specified, decryption of the file (if necessary) will be done by the client instead of on the fabric node (default:false) | |
callback | function | If specified, will be periodically called with current download status - Required if
|
DownloadPart
libraryId, // optional
objectId, // optional
versionHash, // optional
writeToken, // optional
partHash,
format, // optional
chunked, // optional
chunkSize, // optional
callback // optional
}) → Promise.<ArrayBuffer> | undefined
Download a part from a content object. The fromByte and range parameters can be used to specify a specific section of the part to download.
Returns: No return if chunked is specified, part data in the requested format otherwise
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
libraryId | string | ID of the library | |
objectId | string | ID of the object | |
versionHash | string | Hash of the object version - if not specified, latest version will be used | |
writeToken | string | Write token for the draft from which to download the part | |
partHash | string | ✓ | Hash of the part to download |
format | string | Format in which to return the data ("blob" | "arraybuffer" | "buffer) (default:"arrayBuffer") | |
chunked | boolean | If specified, part will be downloaded and decrypted in chunks. The specified callback will be invoked on completion of each chunk. This is recommended for large files, especially if they are encrypted. (default:false) | |
chunkSize | number | Size of file chunks to request for download
1000000) | |
callback | function | If specified, will be periodically called with current download status - Required if
|
FinalizePart
libraryId,
objectId,
writeToken,
partWriteToken,
encryption // optional
}) → Promise.<object>
Finalize an open part draft
Returns: The finalize response for the new part
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
libraryId | string | ✓ | ID of the library |
objectId | string | ✓ | ID of the object |
writeToken | string | ✓ | Write token of the content object draft |
partWriteToken | string | ✓ | Write token of the part |
encryption | string | Desired encryption scheme. Options: 'none' (default), 'cgck' (default:none) |
ListFiles
libraryId, // optional
objectId, // optional
path, // optional
versionHash, // optional
writeToken // optional
})
List the file information about this object
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
libraryId | string | ID of the library | |
objectId | string | ID of the object | |
path | string | ID of the object | |
versionHash | string | Hash of the object version - if not specified, most recent version will be used | |
writeToken | string | Write token of a draft (incompatible with versionHash) |
MoveFiles
libraryId,
objectId,
writeToken,
filePaths
})
Move or rename the specified list of files/directories
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
libraryId | string | ✓ | ID of the library |
objectId | string | ✓ | ID of the object |
writeToken | string | ✓ | Write token of the draft |
filePaths | Array.<string> | ✓ | List of file paths to move. Format: |
UploadFiles
libraryId,
objectId,
writeToken,
fileInfo,
encryption,
callback // optional
})
Upload files to a content object.
Expected format of fileInfo:
[
{
path: string,
mime_type: string,
size: number,
data: File | ArrayBuffer | Buffer | File Descriptor (Node)
}
]
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
libraryId | string | ✓ | ID of the library |
objectId | string | ✓ | ID of the object |
writeToken | string | ✓ | Write token of the draft |
fileInfo | Array.<object> | ✓ | List of files to upload, including their size, type, and contents |
encryption | string | ✓ | Encryption for uploaded files - cgck | none (default:"none") |
callback | function | If specified, will be called after each job segment is finished with the current upload progress
|
UploadFilesFromS3
libraryId,
objectId,
writeToken,
region,
bucket,
fileInfo,
accessKey,
secret,
signedUrl, // optional
encryption,
copy,
callback // optional
})
Copy/reference files from S3 to a content object.
S3 authentication is done by either providing an access key and secret or a presigned URL. The credentials will not be stored (neither in the client nor in the Fabric)
NOTE: When providing a presigned URL instead of an access key + secret, the accessKey, secret, region and bucket parameters are not required.
Expected format of fileInfo:
[
{
path: string,
source: string // either a full path e.g. "s3://BUCKET_NAME/path..." or just the path part without "s3://BUCKET_NAME/"
}
]
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
libraryId | string | ✓ | ID of the library |
objectId | string | ✓ | ID of the object |
writeToken | string | ✓ | Write token of the draft |
region | string | ✓ | AWS region to use |
bucket | string | ✓ | AWS bucket to use |
fileInfo | Array.<Object> | ✓ | List of files to reference/copy |
accessKey | string | ✓ | AWS access key |
secret | string | ✓ | AWS secret |
signedUrl | string | ||
encryption | string | ✓ | Encryption for uploaded files (copy only) - cgck | none (default:"none") |
copy | boolean | ✓ | If true, will copy the data from S3 into the fabric. Otherwise, a reference to the content will be made. (default:false) |
callback | function | If specified, will be periodically called with current upload status
|
UploadPart
libraryId,
objectId,
writeToken,
data,
chunkSize, // optional
encryption, // optional
callback // optional
}) → Promise.<Object>
Upload part to an object draft
Note: If uploading a large file (especially with an HTML file and/or when using the FrameClient) it is recommended to use the CreatePart + UploadPartChunk + FinalizePart flow to upload the file in smaller chunks.
Returns: Response containing information about the uploaded part
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
libraryId | string | ✓ | ID of the library |
objectId | string | ✓ | ID of the object |
writeToken | string | ✓ | Write token of the content object draft |
data | File | ArrayBuffer | Buffer | ✓ | Data to upload |
chunkSize | number | (1MB) - Chunk size, in bytes (default:1000000) | |
encryption | string | Desired encryption scheme. Options: 'none' (default), 'cgck' (default:none) | |
callback | function | If specified, will be periodically called with current upload status
|
UploadPartChunk
libraryId,
objectId,
writeToken,
partWriteToken,
chunk,
encryption // optional
}) → Promise.<string>
Upload data to an open part draft
Returns: The part write token for the part draft
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
libraryId | string | ✓ | ID of the library |
objectId | string | ✓ | ID of the object |
writeToken | string | ✓ | Write token of the content object draft |
partWriteToken | string | ✓ | Write token of the part |
chunk | ArrayBuffer | Buffer | ✓ | Data to upload |
encryption | string | Desired encryption scheme. Options: 'none' (default), 'cgck' (default:none) |