The Replit Object Storage Client is the official JavaScript SDK for managing interactions with Replit Object Storage. This lets you programmatically copy, delete, upload, and download objects within Replit Object Storage buckets.
Client
class from the object-storage
library and provides code examples for its methods.
Client
class manages interactions with Replit Object Storage. This class features methods for performing operations on objects in a bucket.
To import the class from the library, add the following line to your JavaScript code:
Client
instance that interacts with Replit Object Storage:
options?
): Client
Name | Type | Description |
---|---|---|
options? | ClientOptions | Configuration options for setting up the client. |
Client
objectName
, destObjectName
): Promise
<Result
<null
, RequestError
>>Name | Type | Description |
---|---|---|
objectName | string | The full path of the object to copy. |
destObjectName | string | The full path to copy the object to. |
Promise
<Result
<null
, RequestError
>>
objectName
, options?
): Promise
<Result
<null
, RequestError
>>Name | Type | Description |
---|---|---|
objectName | string | The full path of the object to delete. |
options? | DeleteOptions | Configurations for the delete operation. |
Promise
<Result
<null
, RequestError
>>
objectName
, options?
): Promise
<Result
<Buffer
, RequestError
>>Name | Type | Description |
---|---|---|
objectName | string | The full path of the object to download. |
options? | DownloadOptions | Configurations for the download operation. |
Promise
<Result
<Buffer
, RequestError
>>
objectName
, options?
): Readable
Name | Type | Description |
---|---|---|
objectName | string | The full path of the object to download. |
options? | DownloadOptions | Configurations for the download operation. |
Readable
objectName
, options?
): Promise
<Result
<string
, RequestError
>>Name | Type | Description |
---|---|---|
objectName | string | The full path of the object to download. |
options? | DownloadOptions | Configurations for the download operation. |
Promise
<Result
<string
, RequestError
>>
objectName
, destFilename
, options?
): Promise
<Result
<null
, RequestError
>>Name | Type | Description |
---|---|---|
objectName | string | The full path of the object to download. |
destFilename | string | The path on the local filesystem to write the downloaded object to. |
options? | DownloadOptions | Configurations for the download operation. |
Promise
<Result
<null
, RequestError
>>
objectName
): Promise
<Result
<boolean
, RequestError
>>Name | Type | Description |
---|---|---|
objectName | string | The full path of the object to check. |
Promise
<Result
<boolean
, RequestError
>>
Promise
<Bucket
>Promise
<Bucket
>
bucketId?
): Promise
<Bucket
>Name | Type |
---|---|
bucketId? | string |
Promise
<Bucket
>
options?
): Promise
<Result
<StorageObject
[], RequestError
>>Name | Type | Description |
---|---|---|
options? | ListOptions | Configurations for the list operation. |
Promise
<Result
<StorageObject
[], RequestError
>>
options?
): undefined
| UploadOptions
Name | Type |
---|---|
options? | UploadOptions |
undefined
| UploadOptions
objectName
, contents
, options?
): Promise
<Result
<null
, RequestError
>>Name | Type | Description |
---|---|---|
objectName | string | The full destination path of the object. |
contents | Buffer | The raw contents of the object in byte form. |
options? | UploadOptions | Configurations for the upload operation. |
Promise
<Result
<null
, RequestError
>>
objectName
, srcFilename
, options?
): Promise
<Result
<null
, RequestError
>>Name | Type | Description |
---|---|---|
objectName | string | The full destination path of the object. |
srcFilename | string | The path of the file on the local filesystem to upload. |
options? | UploadOptions | Configurations for the upload operation. |
Promise
<Result
<null
, RequestError
>>
objectName
, stream
, options?
): Promise
<void
>Name | Type | Description |
---|---|---|
objectName | string | The full destination path of the object. |
stream | Readable | A readable stream from which to read the object’s contents. |
options? | UploadOptions | Configurations for the upload operation. |
Promise
<void
>
objectName
, contents
, options?
): Promise
<Result
<null
, RequestError
>>Name | Type | Description |
---|---|---|
objectName | string | The full destination path of the object. |
contents | string | The contents of the object in text form. |
options? | UploadOptions | Configurations for the upload operation. |
Promise
<Result
<null
, RequestError
>>