Private
ctxPrivate
appendUploads a file using a buffer.
Example Usage:
const alphabet = {a: 1, b: 2, c: 3}
const fileBuffer = Buffer.from(alphabet, 'utf-8');
const fileName = 'alphabet.json';
const uploadFile = await new Files().createAndUploadFileFromBuffer(fileBuffer, 'text/json', fileName, null, 24 * 60 * 60 * 1000);
The buffer of the object to upload. Can be created by Buffer.from(theObject, 'utf-8')
The content type of the file. Example: 'text/json', 'image/png', 'image/jpeg', or 'application/pdf'
The name of the file
The entity reference that owns this file.
The time to live of this file (in milliseconds)
The file entity that was created.
Generated using TypeDoc
A helper class for handling files in contrail. For uploading files, we recommend using the createAndUploadFileFromBuffer method for most use cases.
Once a file is uploaded, the download link is stored in the
downloadUrl
property of the returned file object. The download url is valid for 24 hours. If you wish to refresh the download url, you can fetch the file entity again, using its id. This assumes that you've stored the file ID.