Skip to main content

Class: StorageClient

Methods

deleteFile

deleteFile(filePathInBucket): Promise<void>

Deletes a single file from a specified path within the bucket.

Parameters

NameTypeDescription
filePathInBucketstringThe path of the file within the bucket to be deleted.

Returns

Promise<void>

A promise that resolves to void when the file has been deleted.


deleteFiles

deleteFiles(filePathsInBucket): Promise<void>

Deletes multiple files from specified paths within the bucket.

Parameters

NameTypeDescription
filePathsInBucketstring[]An array of paths for the files within the bucket to be deleted.

Returns

Promise<void>

A promise that resolves to void when all specified files have been deleted.


getDownloadUrl

getDownloadUrl(filePathInBucket, urlExpirationInSeconds?): Promise<GetDownloadUrlResponse>

Generates a URL for downloading a file from a specified path within the bucket.

Parameters

NameTypeDescription
filePathInBucketstringThe path of the file within the bucket for which to generate the download URL.
urlExpirationInSeconds?numberOptional expiration time in seconds for the download URL.

Returns

Promise<GetDownloadUrlResponse>

A promise that resolves to a GetDownloadUrlResponse containing the download URL.


getFileMetadata

getFileMetadata(filePathInBucket): Promise<GetFileMetadataResponse>

Retrieves metadata for a file located in a specified path within the bucket.

Parameters

NameTypeDescription
filePathInBucketstringThe path of the file within the bucket.

Returns

Promise<GetFileMetadataResponse>

A promise that resolves to a GetFileMetadataResponse containing the file's metadata.


listDirectoryContents

listDirectoryContents(dirPathInBucket): Promise<ListDirectoryContentsResponse>

Lists the contents of a directory within the bucket.

Parameters

NameTypeDescription
dirPathInBucketstringThe path of the directory within the bucket.

Returns

Promise<ListDirectoryContentsResponse>

A promise that resolves to a ListDirectoryContentsResponse containing the directory contents.


uploadFile

uploadFile(dirPathInBucket, file, expirationInSeconds?): Promise<void>

Uploads a file to a specified directory within the bucket.

Parameters

NameTypeDescription
dirPathInBucketstringThe directory path within the bucket where the file should be uploaded.
fileBlobAndFilename | FileThe file or blob (with filename) to upload.
expirationInSeconds?numberOptional expiration time in seconds for the upload.

Returns

Promise<void>

A promise that resolves to void when the upload is complete.