Creates an instance of FileManager to manage a specific bucket of your cloud storage.
The name or id of the bucket that this file is contained in
The name of id of the file that this file manager will be operating on
The http client to make RESTful API calls to the application's execution engine
The name or id of the bucket
The name or id of the file
The http client to make RESTful API calls to the application's execution engine
Adds the specified tags to file's metadata.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
A single tag or an array of tags to add to file's metadata
Returns the updated file information
Copies the file to another bucket. If there already exists a file with the same name in destination bucket, it ensures the copied file name to be unique in its new destination.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
The name or id of the bucket to copy the file into.
Returns the copied file information
Deletes the file from the bucket.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
Downloads the file.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
Returns the contents of the file in a Blob
Duplicates an existing file within the same bucket.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
The new duplicate file name. If not specified, uses the fileName
as template and ensures the duplicated file name to be unique in its bucket.
Returns the new duplicate file information
Check if the file exists. It returns false if file does not exist.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
Returns true if file exists, false otherwise
Gets information about the file.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
Returns basic file metadata informaton.
Sets the default privacy of the file to false.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
Returns the updated file information
Sets the default privacy of the file to true.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
Returns the updated file information
Moves the file to another bucket. The file will be removed from its current bucket and will be moved to its new bucket. If there already exists a file with the same name in destination bucket, it ensures the moved file name to be unique in its new destination.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
The name or id of the bucket to move the file into.
Returns the moved file information
Removes the specified tags from file's metadata.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
A single tag or an array of tags to remove from file's metadata
Returns the updated file information
Renames the file.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
The new name of the file.
Returns the updated file information
Replaces an existing file with another. It keeps the name of the file but replaces file contents, size, encoding and mime-type with the newly uploaded file info.
If onProgress
callback function is defined in FileUploadOptions, it periodically calls this function to inform about upload progress. Please note that for the moment onProgress
callback function can only be used in clients where XMLHttpRequest
object is available (e.g., browsers).
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
The body of the new file that will be used to replace the existing file
Content type and privacy setting of the new file. contentType
is ignored, if fileBody
is Blob
, File
or FormData
, otherwise contentType
option needs to be specified. If not specified, contentType
will default to text/plain;charset=UTF-8
. If isPublic
is not specified, defaults to the bucket's privacy setting.
Returns the metadata of the file after replacement
Updates the overall file metadata (name, isPublic and tags) in a single method call.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
The new name of the file.
The privacy setting of the file.
Array of string values that will be added to the file metadata.
Returns the updated file information
Generated using TypeDoc
FileManager is primarily used to manage a file. Using the BucketManager.file method, you can create a FileManager instance for a specific file identified by its unique name or id.