# Complete API Reference

API reference for [`@tigrisdata/storage`](https://www.npmjs.com/package/@tigrisdata/storage) v3.0.0.

For usage examples and guides, see [Using the SDK](/docs/sdks/tigris/using-sdk/.md).

## Contents[​](#contents "Direct link to Contents")

* [Client API](#client-api)
* [Object Operations](#object-operations)
* [Presigned URLs](#presigned-urls)
* [Bucket Management](#bucket-management)
* [Bucket Configuration](#bucket-configuration)
* [Snapshots](#snapshots)
* [Multipart Upload](#multipart-upload)
* [Client Upload Handling](#client-upload-handling)
* [Statistics](#statistics)
* [Common Types](#common-types)

## Client API[​](#client-api "Direct link to Client API")

Functions and types exported from `@tigrisdata/storage/client` for browser-side uploads.

### `upload`[​](#upload "Direct link to upload")

```
function upload(

  name: string,

  data: File | Blob,

  options?: UploadOptions,

): Promise<TigrisStorageResponse<UploadResponse, Error>>;
```

### `executeWithConcurrency`[​](#executewithconcurrency "Direct link to executewithconcurrency")

Executes an array of task functions with a concurrency limit. Each task is a function that returns a Promise.

```
function executeWithConcurrency<T>(

  tasks: (() => Promise<T>)[],

  concurrency: number,

): Promise<T[]>;
```

#### Types[​](#types "Direct link to Types")

### `UploadOptions`[​](#uploadoptions "Direct link to uploadoptions")

```
type UploadOptions = {

  access?: "public" | "private";

  addRandomSuffix?: boolean;

  allowOverwrite?: boolean;

  contentType?: string;

  contentDisposition?: "attachment" | "inline";

  url?: string;

  multipart?: boolean;

  partSize?: number;

  /**

   * Maximum number of concurrent part uploads for multipart uploads

   * @default 4

   */

  concurrency?: number;

  onUploadProgress?: (progress: UploadProgress) => void;

};
```

| Property             | Type                                    | Required | Description                                                     |
| -------------------- | --------------------------------------- | -------- | --------------------------------------------------------------- |
| `access`             | `'public' \| 'private'`                 | No       |                                                                 |
| `addRandomSuffix`    | `boolean`                               | No       |                                                                 |
| `allowOverwrite`     | `boolean`                               | No       |                                                                 |
| `contentType`        | `string`                                | No       |                                                                 |
| `contentDisposition` | `'attachment' \| 'inline'`              | No       |                                                                 |
| `url`                | `string`                                | No       |                                                                 |
| `multipart`          | `boolean`                               | No       |                                                                 |
| `partSize`           | `number`                                | No       |                                                                 |
| `concurrency`        | `number`                                | No       | Maximum number of concurrent part uploads for multipart uploads |
| `onUploadProgress`   | `(progress: UploadProgress) =&gt; void` | No       |                                                                 |

### `UploadProgress`[​](#uploadprogress "Direct link to uploadprogress")

```
type UploadProgress = {

  loaded: number;

  total: number;

  percentage: number;

};
```

| Property     | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `loaded`     | `number` | Yes      |             |
| `total`      | `number` | Yes      |             |
| `percentage` | `number` | Yes      |             |

### `UploadResponse`[​](#uploadresponse "Direct link to uploadresponse")

```
type UploadResponse = {

  contentDisposition?: string;

  contentType?: string;

  modified: Date;

  name: string;

  size: number;

  url: string;

};
```

| Property             | Type     | Required | Description |
| -------------------- | -------- | -------- | ----------- |
| `contentDisposition` | `string` | No       |             |
| `contentType`        | `string` | No       |             |
| `modified`           | `Date`   | Yes      |             |
| `name`               | `string` | Yes      |             |
| `size`               | `number` | Yes      |             |
| `url`                | `string` | Yes      |             |

## Object Operations[​](#object-operations "Direct link to Object Operations")

Create, read, update, and delete objects in a bucket.

### `put`[​](#put "Direct link to put")

```
function put(

  path: string,

  body: string | ReadableStream | Blob | Buffer,

  options?: PutOptions,

): Promise<TigrisStorageResponse<PutResponse, Error>>;
```

### `get`[​](#get "Direct link to get")

**Overloads:**

```
function get(

  path: string,

  format: "string",

  options?: GetOptions,

): Promise<TigrisStorageResponse<string, Error>>;
```

```
function get(

  path: string,

  format: "file",

  options?: GetOptions,

): Promise<TigrisStorageResponse<File, Error>>;
```

```
function get(

  path: string,

  format: "stream",

  options?: GetOptions,

): Promise<TigrisStorageResponse<ReadableStream, Error>>;
```

### `head`[​](#head "Direct link to head")

```
function head(

  path: string,

  options?: HeadOptions,

): Promise<TigrisStorageResponse<HeadResponse | void, Error>>;
```

### `list`[​](#list "Direct link to list")

```
function list(

  options?: ListOptions,

): Promise<TigrisStorageResponse<ListResponse, Error>>;
```

### `remove`[​](#remove "Direct link to remove")

```
function remove(

  path: string,

  options?: RemoveOptions,

): Promise<TigrisStorageResponse<void, Error>>;
```

### `updateObject`[​](#updateobject "Direct link to updateobject")

```
function updateObject(

  path: string,

  options?: UpdateObjectOptions,

): Promise<TigrisStorageResponse<UpdateObjectResponse, Error>>;
```

#### Types[​](#types-1 "Direct link to Types")

### `PutOptions`[​](#putoptions "Direct link to putoptions")

```
type PutOptions = {

  access?: "public" | "private";

  addRandomSuffix?: boolean;

  allowOverwrite?: boolean;

  contentType?: string;

  contentDisposition?: "attachment" | "inline";

  multipart?: boolean;

  partSize?: number;

  queueSize?: number;

  abortController?: AbortController;

  onUploadProgress?: PutOnUploadProgress;

  config?: TigrisStorageConfig;

};
```

| Property             | Type                       | Required | Description |
| -------------------- | -------------------------- | -------- | ----------- |
| `access`             | `'public' \| 'private'`    | No       |             |
| `addRandomSuffix`    | `boolean`                  | No       |             |
| `allowOverwrite`     | `boolean`                  | No       |             |
| `contentType`        | `string`                   | No       |             |
| `contentDisposition` | `'attachment' \| 'inline'` | No       |             |
| `multipart`          | `boolean`                  | No       |             |
| `partSize`           | `number`                   | No       |             |
| `queueSize`          | `number`                   | No       |             |
| `abortController`    | `AbortController`          | No       |             |
| `onUploadProgress`   | `PutOnUploadProgress`      | No       |             |
| `config`             | `TigrisStorageConfig`      | No       |             |

### `PutResponse`[​](#putresponse "Direct link to putresponse")

```
type PutResponse = {

  contentDisposition: string | undefined;

  contentType: string | undefined;

  modified: Date;

  path: string;

  size: number;

  url: string;

};
```

| Property             | Type                  | Required | Description |
| -------------------- | --------------------- | -------- | ----------- |
| `contentDisposition` | `string \| undefined` | Yes      |             |
| `contentType`        | `string \| undefined` | Yes      |             |
| `modified`           | `Date`                | Yes      |             |
| `path`               | `string`              | Yes      |             |
| `size`               | `number`              | Yes      |             |
| `url`                | `string`              | Yes      |             |

### `PutOnUploadProgress`[​](#putonuploadprogress "Direct link to putonuploadprogress")

```
type PutOnUploadProgress = ({

  loaded,

  total,

  percentage,

}: {

  loaded: number;

  total: number;

  percentage: number;

}) => void;
```

### `GetOptions`[​](#getoptions "Direct link to getoptions")

```
type GetOptions = {

  config?: TigrisStorageConfig;

  contentDisposition?: "attachment" | "inline";

  contentType?: string;

  encoding?: string;

  snapshotVersion?: string;

};
```

| Property             | Type                       | Required | Description |
| -------------------- | -------------------------- | -------- | ----------- |
| `config`             | `TigrisStorageConfig`      | No       |             |
| `contentDisposition` | `'attachment' \| 'inline'` | No       |             |
| `contentType`        | `string`                   | No       |             |
| `encoding`           | `string`                   | No       |             |
| `snapshotVersion`    | `string`                   | No       |             |

### `GetResponse`[​](#getresponse "Direct link to getresponse")

```
type GetResponse = string | File | ReadableStream;
```

### `HeadOptions`[​](#headoptions "Direct link to headoptions")

```
type HeadOptions = {

  snapshotVersion?: string;

  config?: TigrisStorageConfig;

};
```

| Property          | Type                  | Required | Description |
| ----------------- | --------------------- | -------- | ----------- |
| `snapshotVersion` | `string`              | No       |             |
| `config`          | `TigrisStorageConfig` | No       |             |

### `HeadResponse`[​](#headresponse "Direct link to headresponse")

```
type HeadResponse = {

  contentDisposition: string;

  contentType: string;

  modified: Date;

  path: string;

  size: number;

  url: string;

};
```

| Property             | Type     | Required | Description |
| -------------------- | -------- | -------- | ----------- |
| `contentDisposition` | `string` | Yes      |             |
| `contentType`        | `string` | Yes      |             |
| `modified`           | `Date`   | Yes      |             |
| `path`               | `string` | Yes      |             |
| `size`               | `number` | Yes      |             |
| `url`                | `string` | Yes      |             |

### `ListOptions`[​](#listoptions "Direct link to listoptions")

```
type ListOptions = {

  delimiter?: string;

  prefix?: string;

  limit?: number;

  paginationToken?: string;

  snapshotVersion?: string;

  config?: TigrisStorageConfig;

};
```

| Property          | Type                  | Required | Description |
| ----------------- | --------------------- | -------- | ----------- |
| `delimiter`       | `string`              | No       |             |
| `prefix`          | `string`              | No       |             |
| `limit`           | `number`              | No       |             |
| `paginationToken` | `string`              | No       |             |
| `snapshotVersion` | `string`              | No       |             |
| `config`          | `TigrisStorageConfig` | No       |             |

### `ListItem`[​](#listitem "Direct link to listitem")

```
type ListItem = {

  id: string;

  name: string;

  size: number;

  lastModified: Date;

};
```

| Property       | Type     | Required | Description |
| -------------- | -------- | -------- | ----------- |
| `id`           | `string` | Yes      |             |
| `name`         | `string` | Yes      |             |
| `size`         | `number` | Yes      |             |
| `lastModified` | `Date`   | Yes      |             |

### `ListResponse`[​](#listresponse "Direct link to listresponse")

```
type ListResponse = {

  items: ListItem[];

  paginationToken: string | undefined;

  hasMore: boolean;

};
```

| Property          | Type                  | Required | Description |
| ----------------- | --------------------- | -------- | ----------- |
| `items`           | `ListItem[]`          | Yes      |             |
| `paginationToken` | `string \| undefined` | Yes      |             |
| `hasMore`         | `boolean`             | Yes      |             |

### `RemoveOptions`[​](#removeoptions "Direct link to removeoptions")

```
type RemoveOptions = {

  config?: TigrisStorageConfig;

};
```

| Property | Type                  | Required | Description |
| -------- | --------------------- | -------- | ----------- |
| `config` | `TigrisStorageConfig` | No       |             |

### `UpdateObjectOptions`[​](#updateobjectoptions "Direct link to updateobjectoptions")

```
type UpdateObjectOptions = {

  config?: TigrisStorageConfig;

  key?: string;

  access?: "public" | "private";

};
```

| Property | Type                    | Required | Description |
| -------- | ----------------------- | -------- | ----------- |
| `config` | `TigrisStorageConfig`   | No       |             |
| `key`    | `string`                | No       |             |
| `access` | `'public' \| 'private'` | No       |             |

### `UpdateObjectResponse`[​](#updateobjectresponse "Direct link to updateobjectresponse")

```
type UpdateObjectResponse = {

  path: string;

};
```

| Property | Type     | Required | Description |
| -------- | -------- | -------- | ----------- |
| `path`   | `string` | Yes      |             |

## Presigned URLs[​](#presigned-urls "Direct link to Presigned URLs")

Generate presigned URLs for time-limited access to objects.

### `getPresignedUrl`[​](#getpresignedurl "Direct link to getpresignedurl")

```
function getPresignedUrl(

  path: string,

  options: GetPresignedUrlOptions,

): Promise<TigrisStorageResponse<GetPresignedUrlResponse, Error>>;
```

#### Types[​](#types-2 "Direct link to Types")

### `GetPresignedUrlOptions`[​](#getpresignedurloptions "Direct link to getpresignedurloptions")

```
type GetPresignedUrlOptions = {

  /**

   * The access key ID to use for the presigned URL.

   * If not provided, the access key ID from the config will be used.

   */

  accessKeyId?: string;

  /**

   * The expiration time of the presigned URL in seconds.

   * Default is 3600 seconds (1 hour).

   */

  expiresIn?: number;

  config?: TigrisStorageConfig;

} & MethodOrOperation;
```

| Property                                                         | Type                  | Required | Description                                          |
| ---------------------------------------------------------------- | --------------------- | -------- | ---------------------------------------------------- |
| `accessKeyId`                                                    | `string`              | No       | The access key ID to use for the presigned URL.      |
| If not provided, the access key ID from the config will be used. |                       |          |                                                      |
| `expiresIn`                                                      | `number`              | No       | The expiration time of the presigned URL in seconds. |
| Default is 3600 seconds (1 hour).                                |                       |          |                                                      |
| `config`                                                         | `TigrisStorageConfig` | No       |                                                      |

### `GetPresignedUrlResponse`[​](#getpresignedurlresponse "Direct link to getpresignedurlresponse")

```
type GetPresignedUrlResponse = {

  url: string;

  expiresIn: number;

} & MethodOrOperation;
```

| Property    | Type     | Required | Description |
| ----------- | -------- | -------- | ----------- |
| `url`       | `string` | Yes      |             |
| `expiresIn` | `number` | Yes      |             |

### `GetPresignedUrlOperation`[​](#getpresignedurloperation "Direct link to getpresignedurloperation")

```
type GetPresignedUrlOperation = "get" | "put";
```

### `MethodOrOperation`[​](#methodoroperation "Direct link to methodoroperation")

```
type MethodOrOperation =

  | {

      method: GetPresignedUrlOperation;

      operation?: never;

    }

  | {

      operation: GetPresignedUrlOperation;

      method?: never;

    };
```

| Property    | Type                       | Required | Description |
| ----------- | -------------------------- | -------- | ----------- |
| `method`    | `GetPresignedUrlOperation` | Yes      |             |
| `operation` | `never`                    | No       |             |
| `operation` | `GetPresignedUrlOperation` | Yes      |             |
| `method`    | `never`                    | No       |             |

## Bucket Management[​](#bucket-management "Direct link to Bucket Management")

Create, list, update, and delete buckets.

### `createBucket`[​](#createbucket "Direct link to createbucket")

```
function createBucket(

  bucketName: string,

  options?: CreateBucketOptions,

): Promise<TigrisStorageResponse<CreateBucketResponse, Error>>;
```

### `getBucketInfo`[​](#getbucketinfo "Direct link to getbucketinfo")

```
function getBucketInfo(

  bucketName: string,

  options?: GetBucketInfoOptions,

): Promise<TigrisStorageResponse<BucketInfoResponse, Error>>;
```

### `listBuckets`[​](#listbuckets "Direct link to listbuckets")

```
function listBuckets(

  options?: ListBucketsOptions,

): Promise<TigrisStorageResponse<ListBucketsResponse, Error>>;
```

### `updateBucket`[​](#updatebucket "Direct link to updatebucket")

```
function updateBucket(

  bucketName: string,

  options?: UpdateBucketOptions,

): Promise<TigrisStorageResponse<UpdateBucketResponse, Error>>;
```

### `removeBucket`[​](#removebucket "Direct link to removebucket")

```
function removeBucket(

  bucketName: string,

  options?: RemoveBucketOptions,

): Promise<TigrisStorageResponse<void, Error>>;
```

#### Types[​](#types-3 "Direct link to Types")

### `CreateBucketOptions`[​](#createbucketoptions "Direct link to createbucketoptions")

```
type CreateBucketOptions = {

  enableSnapshot?: boolean;

  sourceBucketName?: string;

  sourceBucketSnapshot?: string;

  access?: "public" | "private";

  defaultTier?: StorageClass;

  locations?: BucketLocations;

  config?: Omit<TigrisStorageConfig, "bucket">;

};
```

| Property               | Type                                        | Required | Description |
| ---------------------- | ------------------------------------------- | -------- | ----------- |
| `enableSnapshot`       | `boolean`                                   | No       |             |
| `sourceBucketName`     | `string`                                    | No       |             |
| `sourceBucketSnapshot` | `string`                                    | No       |             |
| `access`               | `'public' \| 'private'`                     | No       |             |
| `defaultTier`          | `StorageClass`                              | No       |             |
| `locations`            | `BucketLocations`                           | No       |             |
| `config`               | `Omit&lt;TigrisStorageConfig, 'bucket'&gt;` | No       |             |

### `CreateBucketResponse`[​](#createbucketresponse "Direct link to createbucketresponse")

```
type CreateBucketResponse = {

  isSnapshotEnabled: boolean;

  hasForks: boolean;

  sourceBucketName?: string;

  sourceBucketSnapshot?: string;

};
```

| Property               | Type      | Required | Description |
| ---------------------- | --------- | -------- | ----------- |
| `isSnapshotEnabled`    | `boolean` | Yes      |             |
| `hasForks`             | `boolean` | Yes      |             |
| `sourceBucketName`     | `string`  | No       |             |
| `sourceBucketSnapshot` | `string`  | No       |             |

### `GetBucketInfoOptions`[​](#getbucketinfooptions "Direct link to getbucketinfooptions")

```
type GetBucketInfoOptions = {

  config?: TigrisStorageConfig;

};
```

| Property | Type                  | Required | Description |
| -------- | --------------------- | -------- | ----------- |
| `config` | `TigrisStorageConfig` | No       |             |

### `BucketInfoResponse`[​](#bucketinforesponse "Direct link to bucketinforesponse")

```
type BucketInfoResponse = {

  isSnapshotEnabled: boolean;

  forkInfo:

    | {

        hasChildren: boolean;

        parents: Array<{

          bucketName: string;

          forkCreatedAt: Date;

          snapshot: string;

          snapshotCreatedAt: Date;

        }>;

      }

    | undefined;

  settings: {

    allowObjectAcl: boolean;

    defaultTier: StorageClass;

    lifecycleRules?: BucketLifecycleRule[];

    dataMigration?: Omit<BucketMigration, "enabled">;

    ttlConfig?: BucketTtl;

    customDomain?: string;

    deleteProtection: boolean;

    corsRules: BucketCorsRule[];

    additionalHeaders?: Record<string, string>;

    notifications?: BucketNotification;

  };

  sizeInfo: {

    numberOfObjects: number | undefined;

    size: number | undefined;

    numberOfObjectsAllVersions: number | undefined;

  };

};
```

| Property            | Type                                                                                                                                                                                                                                                                                                                                                    | Required | Description |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------- |
| `isSnapshotEnabled` | `boolean`                                                                                                                                                                                                                                                                                                                                               | Yes      |             |
| `forkInfo`          | `\{ hasChildren: boolean; parents: Array&lt;\{ bucketName: string; forkCreatedAt: Date; snapshot: string; snapshotCreatedAt: Date; \}&gt;; \} \| undefined`                                                                                                                                                                                             | Yes      |             |
| `settings`          | `\{ allowObjectAcl: boolean; defaultTier: StorageClass; lifecycleRules?: BucketLifecycleRule[]; dataMigration?: Omit&lt;BucketMigration, 'enabled'&gt;; ttlConfig?: BucketTtl; customDomain?: string; deleteProtection: boolean; corsRules: BucketCorsRule[]; additionalHeaders?: Record&lt;string, string&gt;; notifications?: BucketNotification; \}` | Yes      |             |
| `sizeInfo`          | `\{ numberOfObjects: number \| undefined; size: number \| undefined; numberOfObjectsAllVersions: number \| undefined; \}`                                                                                                                                                                                                                               | Yes      |             |

### `ListBucketsOptions`[​](#listbucketsoptions "Direct link to listbucketsoptions")

```
type ListBucketsOptions = {

  config?: TigrisStorageConfig;

  paginationToken?: string;

  limit?: number;

};
```

| Property          | Type                  | Required | Description |
| ----------------- | --------------------- | -------- | ----------- |
| `config`          | `TigrisStorageConfig` | No       |             |
| `paginationToken` | `string`              | No       |             |
| `limit`           | `number`              | No       |             |

### `ListBucketsResponse`[​](#listbucketsresponse "Direct link to listbucketsresponse")

```
type ListBucketsResponse = {

  buckets: Bucket[];

  owner?: BucketOwner;

  paginationToken?: string;

};
```

| Property          | Type          | Required | Description |
| ----------------- | ------------- | -------- | ----------- |
| `buckets`         | `Bucket[]`    | Yes      |             |
| `owner`           | `BucketOwner` | No       |             |
| `paginationToken` | `string`      | No       |             |

### `Bucket`[​](#bucket "Direct link to bucket")

```
type Bucket = {

  name: string;

  creationDate: Date;

};
```

| Property       | Type     | Required | Description |
| -------------- | -------- | -------- | ----------- |
| `name`         | `string` | Yes      |             |
| `creationDate` | `Date`   | Yes      |             |

### `BucketOwner`[​](#bucketowner "Direct link to bucketowner")

```
type BucketOwner = {

  name: string;

  id: string;

};
```

| Property | Type     | Required | Description |
| -------- | -------- | -------- | ----------- |
| `name`   | `string` | Yes      |             |
| `id`     | `string` | Yes      |             |

### `UpdateBucketOptions`[​](#updatebucketoptions "Direct link to updatebucketoptions")

```
type UpdateBucketOptions = {

  access?: "public" | "private";

  allowObjectAcl?: boolean;

  disableDirectoryListing?: boolean;

  locations?: BucketLocations;

  cacheControl?: string;

  customDomain?: string;

  enableAdditionalHeaders?: boolean;

  enableDeleteProtection?: boolean;

  config?: Omit<TigrisStorageConfig, "bucket">;

};
```

| Property                  | Type                                        | Required | Description |
| ------------------------- | ------------------------------------------- | -------- | ----------- |
| `access`                  | `'public' \| 'private'`                     | No       |             |
| `allowObjectAcl`          | `boolean`                                   | No       |             |
| `disableDirectoryListing` | `boolean`                                   | No       |             |
| `locations`               | `BucketLocations`                           | No       |             |
| `cacheControl`            | `string`                                    | No       |             |
| `customDomain`            | `string`                                    | No       |             |
| `enableAdditionalHeaders` | `boolean`                                   | No       |             |
| `enableDeleteProtection`  | `boolean`                                   | No       |             |
| `config`                  | `Omit&lt;TigrisStorageConfig, 'bucket'&gt;` | No       |             |

### `UpdateBucketResponse`[​](#updatebucketresponse "Direct link to updatebucketresponse")

```
type UpdateBucketResponse = {

  bucket: string;

  updated: boolean;

};
```

| Property  | Type      | Required | Description |
| --------- | --------- | -------- | ----------- |
| `bucket`  | `string`  | Yes      |             |
| `updated` | `boolean` | Yes      |             |

### `RemoveBucketOptions`[​](#removebucketoptions "Direct link to removebucketoptions")

```
type RemoveBucketOptions = {

  force?: boolean;

  config?: TigrisStorageConfig;

};
```

| Property | Type                  | Required | Description |
| -------- | --------------------- | -------- | ----------- |
| `force`  | `boolean`             | No       |             |
| `config` | `TigrisStorageConfig` | No       |             |

## Bucket Configuration[​](#bucket-configuration "Direct link to Bucket Configuration")

Configure CORS, lifecycle rules, TTL, migration, and notifications for a bucket.

### `setBucketCors`[​](#setbucketcors "Direct link to setbucketcors")

```
function setBucketCors(

  bucketName: string,

  options?: SetBucketCorsOptions,

): Promise<TigrisStorageResponse<UpdateBucketResponse, Error>>;
```

### `setBucketLifecycle`[​](#setbucketlifecycle "Direct link to setbucketlifecycle")

```
function setBucketLifecycle(

  bucketName: string,

  options?: SetBucketLifecycleOptions,

): Promise<TigrisStorageResponse<UpdateBucketResponse, Error>>;
```

### `setBucketTtl`[​](#setbucketttl "Direct link to setbucketttl")

```
function setBucketTtl(

  bucketName: string,

  options?: SetBucketTtlOptions,

): Promise<TigrisStorageResponse<UpdateBucketResponse, Error>>;
```

### `setBucketMigration`[​](#setbucketmigration "Direct link to setbucketmigration")

```
function setBucketMigration(

  bucketName: string,

  options?: SetBucketMigrationOptions,

): Promise<TigrisStorageResponse<UpdateBucketResponse, Error>>;
```

### `setBucketNotifications`[​](#setbucketnotifications "Direct link to setbucketnotifications")

Configure webhook notifications for object events on a bucket.

**Scenarios:**

1. If `notificationConfig` is empty (`{}`), sends it as-is to clear notifications.

2. If only `enabled` is provided, fetches the existing config and merges with the new `enabled` value. Errors if no existing config is found.

3. If config is provided without `enabled`, fetches existing config and merges, retaining the existing `enabled` value.

4. `url` is validated when provided (must be a valid http/https URL).

5. `auth.username` and `auth.password` are validated when provided.

6. `auth.token` is validated when provided.

7. `auth.token` and `auth.username`/`auth.password` cannot be provided together.

8. `override` replaces the existing config when `true`. When `false` (default), merges with the existing config.

```
function setBucketNotifications(

  bucketName: string,

  options: SetBucketNotificationsOptions,

): Promise<TigrisStorageResponse<UpdateBucketResponse, Error>>;
```

#### Types[​](#types-4 "Direct link to Types")

### `SetBucketCorsOptions`[​](#setbucketcorsoptions "Direct link to setbucketcorsoptions")

```
type SetBucketCorsOptions = {

  config?: Omit<TigrisStorageConfig, "bucket">;

  override?: boolean;

  rules: BucketCorsRule[];

};
```

| Property   | Type                                        | Required | Description |
| ---------- | ------------------------------------------- | -------- | ----------- |
| `config`   | `Omit&lt;TigrisStorageConfig, 'bucket'&gt;` | No       |             |
| `override` | `boolean`                                   | No       |             |
| `rules`    | `BucketCorsRule[]`                          | Yes      |             |

### `SetBucketLifecycleOptions`[​](#setbucketlifecycleoptions "Direct link to setbucketlifecycleoptions")

```
type SetBucketLifecycleOptions = {

  lifecycleRules: BucketLifecycleRule[];

  config?: Omit<TigrisStorageConfig, "bucket">;

};
```

| Property         | Type                                        | Required | Description |
| ---------------- | ------------------------------------------- | -------- | ----------- |
| `lifecycleRules` | `BucketLifecycleRule[]`                     | Yes      |             |
| `config`         | `Omit&lt;TigrisStorageConfig, 'bucket'&gt;` | No       |             |

### `SetBucketTtlOptions`[​](#setbucketttloptions "Direct link to setbucketttloptions")

```
type SetBucketTtlOptions = {

  ttlConfig?: BucketTtl;

  config?: Omit<TigrisStorageConfig, "bucket">;

};
```

| Property    | Type                                        | Required | Description |
| ----------- | ------------------------------------------- | -------- | ----------- |
| `ttlConfig` | `BucketTtl`                                 | No       |             |
| `config`    | `Omit&lt;TigrisStorageConfig, 'bucket'&gt;` | No       |             |

### `SetBucketMigrationOptions`[​](#setbucketmigrationoptions "Direct link to setbucketmigrationoptions")

```
type SetBucketMigrationOptions = {

  dataMigration?: BucketMigration;

  config?: Omit<TigrisStorageConfig, "bucket">;

};
```

| Property        | Type                                        | Required | Description |
| --------------- | ------------------------------------------- | -------- | ----------- |
| `dataMigration` | `BucketMigration`                           | No       |             |
| `config`        | `Omit&lt;TigrisStorageConfig, 'bucket'&gt;` | No       |             |

### `SetBucketNotificationsOptions`[​](#setbucketnotificationsoptions "Direct link to setbucketnotificationsoptions")

```
type SetBucketNotificationsOptions = {

  config?: Omit<TigrisStorageConfig, "bucket">;

  notificationConfig: BucketNotification;

  override?: boolean;

};
```

| Property             | Type                                        | Required | Description |
| -------------------- | ------------------------------------------- | -------- | ----------- |
| `config`             | `Omit&lt;TigrisStorageConfig, 'bucket'&gt;` | No       |             |
| `notificationConfig` | `BucketNotification`                        | Yes      |             |
| `override`           | `boolean`                                   | No       |             |

### `BucketCorsRule`[​](#bucketcorsrule "Direct link to bucketcorsrule")

```
type BucketCorsRule = {

  allowedOrigins: string | string[];

  allowedMethods?: string | string[];

  allowedHeaders?: string | string[];

  exposeHeaders?: string | string[];

  maxAge?: number;

};
```

| Property         | Type                 | Required | Description |
| ---------------- | -------------------- | -------- | ----------- |
| `allowedOrigins` | `string \| string[]` | Yes      |             |
| `allowedMethods` | `string \| string[]` | No       |             |
| `allowedHeaders` | `string \| string[]` | No       |             |
| `exposeHeaders`  | `string \| string[]` | No       |             |
| `maxAge`         | `number`             | No       |             |

### `BucketLifecycleRule`[​](#bucketlifecyclerule "Direct link to bucketlifecyclerule")

```
type BucketLifecycleRule = {

  id?: string;

  enabled?: boolean;

  storageClass?: Exclude<StorageClass, "STANDARD">;

  days?: number;

  date?: string;

};
```

| Property       | Type                                      | Required | Description |
| -------------- | ----------------------------------------- | -------- | ----------- |
| `id`           | `string`                                  | No       |             |
| `enabled`      | `boolean`                                 | No       |             |
| `storageClass` | `Exclude&lt;StorageClass, 'STANDARD'&gt;` | No       |             |
| `days`         | `number`                                  | No       |             |
| `date`         | `string`                                  | No       |             |

### `BucketTtl`[​](#bucketttl "Direct link to bucketttl")

```
type BucketTtl = {

  id?: string;

  enabled?: boolean;

  days?: number;

  date?: string;

};
```

| Property  | Type      | Required | Description |
| --------- | --------- | -------- | ----------- |
| `id`      | `string`  | No       |             |
| `enabled` | `boolean` | No       |             |
| `days`    | `number`  | No       |             |
| `date`    | `string`  | No       |             |

### `BucketMigration`[​](#bucketmigration "Direct link to bucketmigration")

```
type BucketMigration = {

  enabled: boolean;

  accessKey?: string;

  secretKey?: string;

  region?: string;

  name?: string;

  endpoint?: string;

  writeThrough?: boolean;

};
```

| Property       | Type      | Required | Description |
| -------------- | --------- | -------- | ----------- |
| `enabled`      | `boolean` | Yes      |             |
| `accessKey`    | `string`  | No       |             |
| `secretKey`    | `string`  | No       |             |
| `region`       | `string`  | No       |             |
| `name`         | `string`  | No       |             |
| `endpoint`     | `string`  | No       |             |
| `writeThrough` | `boolean` | No       |             |

### `BucketNotification`[​](#bucketnotification "Direct link to bucketnotification")

```
type BucketNotification =

  | BucketNotificationBase

  | BucketNotificationBasicAuth

  | BucketNotificationTokenAuth;
```

### `BucketNotificationBase`[​](#bucketnotificationbase "Direct link to bucketnotificationbase")

```
type BucketNotificationBase = {

  enabled?: boolean;

  url?: string;

  filter?: string;

};
```

| Property  | Type      | Required | Description |
| --------- | --------- | -------- | ----------- |
| `enabled` | `boolean` | No       |             |
| `url`     | `string`  | No       |             |
| `filter`  | `string`  | No       |             |

### `BucketNotificationBasicAuth`[​](#bucketnotificationbasicauth "Direct link to bucketnotificationbasicauth")

```
type BucketNotificationBasicAuth = BucketNotificationBase & {

  auth: {

    username: string;

    password: string;

    token?: never;

  };

};
```

| Property | Type                                                       | Required | Description |
| -------- | ---------------------------------------------------------- | -------- | ----------- |
| `auth`   | `\{ username: string; password: string; token?: never; \}` | Yes      |             |

### `BucketNotificationTokenAuth`[​](#bucketnotificationtokenauth "Direct link to bucketnotificationtokenauth")

```
type BucketNotificationTokenAuth = BucketNotificationBase & {

  auth: {

    token: string;

    username?: never;

    password?: never;

  };

};
```

| Property | Type                                                       | Required | Description |
| -------- | ---------------------------------------------------------- | -------- | ----------- |
| `auth`   | `\{ token: string; username?: never; password?: never; \}` | Yes      |             |

## Snapshots[​](#snapshots "Direct link to Snapshots")

Create and list bucket snapshots.

### `createBucketSnapshot`[​](#createbucketsnapshot "Direct link to createbucketsnapshot")

**Overloads:**

```
function createBucketSnapshot(

  options?: CreateBucketSnapshotOptions,

): Promise<TigrisStorageResponse<CreateBucketSnapshotResponse, Error>>;
```

```
function createBucketSnapshot(

  sourceBucketName?: string,

  options?: CreateBucketSnapshotOptions,

): Promise<TigrisStorageResponse<CreateBucketSnapshotResponse, Error>>;
```

### `listBucketSnapshots`[​](#listbucketsnapshots "Direct link to listbucketsnapshots")

**Overloads:**

```
function listBucketSnapshots(

  options?: ListBucketSnapshotsOptions,

): Promise<TigrisStorageResponse<ListBucketSnapshotsResponse, Error>>;
```

```
function listBucketSnapshots(

  sourceBucketName?: string,

  options?: ListBucketSnapshotsOptions,

): Promise<TigrisStorageResponse<ListBucketSnapshotsResponse, Error>>;
```

#### Types[​](#types-5 "Direct link to Types")

### `CreateBucketSnapshotOptions`[​](#createbucketsnapshotoptions "Direct link to createbucketsnapshotoptions")

```
type CreateBucketSnapshotOptions = {

  name?: string;

  config?: Omit<TigrisStorageConfig, "bucket">;

};
```

| Property | Type                                        | Required | Description |
| -------- | ------------------------------------------- | -------- | ----------- |
| `name`   | `string`                                    | No       |             |
| `config` | `Omit&lt;TigrisStorageConfig, 'bucket'&gt;` | No       |             |

### `CreateBucketSnapshotResponse`[​](#createbucketsnapshotresponse "Direct link to createbucketsnapshotresponse")

```
type CreateBucketSnapshotResponse = {

  snapshotVersion: string;

};
```

| Property          | Type     | Required | Description |
| ----------------- | -------- | -------- | ----------- |
| `snapshotVersion` | `string` | Yes      |             |

### `ListBucketSnapshotsOptions`[​](#listbucketsnapshotsoptions "Direct link to listbucketsnapshotsoptions")

```
type ListBucketSnapshotsOptions = {

  config?: Omit<TigrisStorageConfig, "bucket">;

  paginationToken?: string;

  limit?: number;

};
```

| Property          | Type                                        | Required | Description |
| ----------------- | ------------------------------------------- | -------- | ----------- |
| `config`          | `Omit&lt;TigrisStorageConfig, 'bucket'&gt;` | No       |             |
| `paginationToken` | `string`                                    | No       |             |
| `limit`           | `number`                                    | No       |             |

### `ListBucketSnapshotsResponse`[​](#listbucketsnapshotsresponse "Direct link to listbucketsnapshotsresponse")

```
type ListBucketSnapshotsResponse = {

  snapshots: BucketSnapshot[];

  paginationToken?: string;

};
```

| Property          | Type               | Required | Description |
| ----------------- | ------------------ | -------- | ----------- |
| `snapshots`       | `BucketSnapshot[]` | Yes      |             |
| `paginationToken` | `string`           | No       |             |

## Multipart Upload[​](#multipart-upload "Direct link to Multipart Upload")

Low-level multipart upload operations for advanced use cases.

### `initMultipartUpload`[​](#initmultipartupload "Direct link to initmultipartupload")

```
function initMultipartUpload(

  path: string,

  options?: InitMultipartUploadOptions,

): Promise<TigrisStorageResponse<InitMultipartUploadResponse, Error>>;
```

### `getPartsPresignedUrls`[​](#getpartspresignedurls "Direct link to getpartspresignedurls")

```
function getPartsPresignedUrls(

  path: string,

  parts: number[],

  uploadId: string,

  options?: GetPartsPresignedUrlsOptions,

): Promise<TigrisStorageResponse<GetPartsPresignedUrlsResponse, Error>>;
```

### `completeMultipartUpload`[​](#completemultipartupload "Direct link to completemultipartupload")

```
function completeMultipartUpload(

  path: string,

  uploadId: string,

  partIds: Array<{

    [key: number]: string;

  }>,

  options?: CompleteMultipartUploadOptions,

): Promise<TigrisStorageResponse<CompleteMultipartUploadResponse, Error>>;
```

#### Types[​](#types-6 "Direct link to Types")

### `InitMultipartUploadOptions`[​](#initmultipartuploadoptions "Direct link to initmultipartuploadoptions")

```
type InitMultipartUploadOptions = {

  config?: TigrisStorageConfig;

};
```

| Property | Type                  | Required | Description |
| -------- | --------------------- | -------- | ----------- |
| `config` | `TigrisStorageConfig` | No       |             |

### `InitMultipartUploadResponse`[​](#initmultipartuploadresponse "Direct link to initmultipartuploadresponse")

```
type InitMultipartUploadResponse = {

  uploadId: string;

};
```

| Property   | Type     | Required | Description |
| ---------- | -------- | -------- | ----------- |
| `uploadId` | `string` | Yes      |             |

### `GetPartsPresignedUrlsOptions`[​](#getpartspresignedurlsoptions "Direct link to getpartspresignedurlsoptions")

```
type GetPartsPresignedUrlsOptions = {

  config?: TigrisStorageConfig;

};
```

| Property | Type                  | Required | Description |
| -------- | --------------------- | -------- | ----------- |
| `config` | `TigrisStorageConfig` | No       |             |

### `GetPartsPresignedUrlsResponse`[​](#getpartspresignedurlsresponse "Direct link to getpartspresignedurlsresponse")

```
type GetPartsPresignedUrlsResponse = Array<{

  part: number;

  url: string;

}>;
```

### `CompleteMultipartUploadOptions`[​](#completemultipartuploadoptions "Direct link to completemultipartuploadoptions")

```
type CompleteMultipartUploadOptions = {

  config?: TigrisStorageConfig;

};
```

| Property | Type                  | Required | Description |
| -------- | --------------------- | -------- | ----------- |
| `config` | `TigrisStorageConfig` | No       |             |

### `CompleteMultipartUploadResponse`[​](#completemultipartuploadresponse "Direct link to completemultipartuploadresponse")

```
type CompleteMultipartUploadResponse = {

  path: string;

  url: string;

};
```

| Property | Type     | Required | Description |
| -------- | -------- | -------- | ----------- |
| `path`   | `string` | Yes      |             |
| `url`    | `string` | Yes      |             |

## Client Upload Handling[​](#client-upload-handling "Direct link to Client Upload Handling")

Server-side handler for processing client upload requests (pairs with the Client API `upload` function).

### `handleClientUpload`[​](#handleclientupload "Direct link to handleclientupload")

```
function handleClientUpload(

  request: ClientUploadRequest,

  config?: TigrisStorageConfig,

): Promise<TigrisStorageResponse<unknown, Error>>;
```

#### Types[​](#types-7 "Direct link to Types")

### `ClientUploadRequest`[​](#clientuploadrequest "Direct link to clientuploadrequest")

```
interface ClientUploadRequest {

  action: UploadAction;

  name: string;

  /** @deprecated This property is no longer used by the server handler. Will be removed in the next major version. */

  contentType?: string;

  uploadId?: string;

  parts?: number[];

  partIds?: Array<{

    [key: number]: string;

  }>;

}
```

| Property      | Type                                        | Required | Description                                                                                                       |
| ------------- | ------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
| `action`      | `UploadAction`                              | Yes      |                                                                                                                   |
| `name`        | `string`                                    | Yes      |                                                                                                                   |
| `contentType` | `string`                                    | No       | **Deprecated.** This property is no longer used by the server handler. Will be removed in the next major version. |
| `uploadId`    | `string`                                    | No       |                                                                                                                   |
| `parts`       | `number[]`                                  | No       |                                                                                                                   |
| `partIds`     | `Array&lt;\{ [key: number]: string; \}&gt;` | No       |                                                                                                                   |

### `UploadAction`[​](#uploadaction "Direct link to uploadaction")

```
enum UploadAction {

  SinglepartInit = "singlepart-init",

  MultipartInit = "multipart-init",

  MultipartGetParts = "multipart-get-parts",

  MultipartComplete = "multipart-complete",

}
```

## Statistics[​](#statistics "Direct link to Statistics")

Retrieve account and bucket-level storage statistics.

### `getStats`[​](#getstats "Direct link to getstats")

```
function getStats(

  options?: GetStatsOptions,

): Promise<TigrisStorageResponse<StatsResponse, Error>>;
```

#### Types[​](#types-8 "Direct link to Types")

### `GetStatsOptions`[​](#getstatsoptions "Direct link to getstatsoptions")

```
type GetStatsOptions = {

  config?: TigrisStorageConfig;

};
```

| Property | Type                  | Required | Description |
| -------- | --------------------- | -------- | ----------- |
| `config` | `TigrisStorageConfig` | No       |             |

### `StatsResponse`[​](#statsresponse "Direct link to statsresponse")

```
type StatsResponse = {

  stats: {

    activeBuckets: number;

    totalObjects: number;

    totalStorageBytes: number;

    totalUniqueObjects: number;

  };

  buckets: Array<{

    name: string;

    creationDate: Date;

    forkInfo:

      | {

          hasChildren: boolean;

          parents: Array<{

            bucketName: string;

            forkCreatedAt: Date;

            snapshot: string;

            snapshotCreatedAt: Date;

          }>;

        }

      | undefined;

    type: BucketType;

    regions: Array<string>;

    visibility: BucketVisibility;

  }>;

};
```

| Property  | Type                                                                                                                                                                                                                                                                                                      | Required | Description |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------- |
| `stats`   | `\{ activeBuckets: number; totalObjects: number; totalStorageBytes: number; totalUniqueObjects: number; \}`                                                                                                                                                                                               | Yes      |             |
| `buckets` | `Array&lt;\{ name: string; creationDate: Date; forkInfo: \{ hasChildren: boolean; parents: Array&lt;\{ bucketName: string; forkCreatedAt: Date; snapshot: string; snapshotCreatedAt: Date; \}&gt;; \} \| undefined; type: BucketType; regions: Array&lt;string&gt;; visibility: BucketVisibility; \}&gt;` | Yes      |             |

### `BucketType`[​](#buckettype "Direct link to buckettype")

```
type BucketType = "Regular" | "Snapshot";
```

### `BucketVisibility`[​](#bucketvisibility "Direct link to bucketvisibility")

```
type BucketVisibility = "public" | "private";
```

## Common Types[​](#common-types "Direct link to Common Types")

Shared configuration and response types used across all API methods.

#### Types[​](#types-9 "Direct link to Types")

### `TigrisStorageConfig`[​](#tigrisstorageconfig "Direct link to tigrisstorageconfig")

```
type TigrisStorageConfig = {

  bucket?: string;

  accessKeyId?: string;

  secretAccessKey?: string;

  endpoint?: string;

  sessionToken?: string;

  organizationId?: string;

  credentialProvider?: () => Promise<{

    accessKeyId: string;

    secretAccessKey: string;

    sessionToken?: string;

    expiration?: Date;

  }>;

};
```

| Property             | Type                                                                                                                    | Required | Description |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------- | -------- | ----------- |
| `bucket`             | `string`                                                                                                                | No       |             |
| `accessKeyId`        | `string`                                                                                                                | No       |             |
| `secretAccessKey`    | `string`                                                                                                                | No       |             |
| `endpoint`           | `string`                                                                                                                | No       |             |
| `sessionToken`       | `string`                                                                                                                | No       |             |
| `organizationId`     | `string`                                                                                                                | No       |             |
| `credentialProvider` | `() =&gt; Promise&lt;\{ accessKeyId: string; secretAccessKey: string; sessionToken?: string; expiration?: Date; \}&gt;` | No       |             |

### `TigrisStorageResponse`[​](#tigrisstorageresponse "Direct link to tigrisstorageresponse")

```
type TigrisStorageResponse<T, E = Error> = TigrisResponse<T, E>;
```

### `TigrisResponse`[​](#tigrisresponse "Direct link to tigrisresponse")

```
type TigrisResponse<T, E = Error> =

  | {

      data: T;

      error?: never;

    }

  | {

      error: E;

      data?: never;

    };
```

| Property | Type    | Required | Description |
| -------- | ------- | -------- | ----------- |
| `data`   | `T`     | Yes      |             |
| `error`  | `never` | No       |             |
| `error`  | `E`     | Yes      |             |
| `data`   | `never` | No       |             |

### `StorageClass`[​](#storageclass "Direct link to storageclass")

```
type StorageClass = "STANDARD" | "STANDARD_IA" | "GLACIER" | "GLACIER_IR";
```

### `BucketLocations`[​](#bucketlocations "Direct link to bucketlocations")

```
type BucketLocations =

  | {

      type: "multi";

      values: BucketLocationMulti;

    }

  | {

      type: "dual";

      values: BucketLocationDualOrSingle | BucketLocationDualOrSingle[];

    }

  | {

      type: "single";

      values: BucketLocationDualOrSingle;

    }

  | {

      type: "global";

      values?: never;

    };
```

| Property | Type                                                         | Required | Description |
| -------- | ------------------------------------------------------------ | -------- | ----------- |
| `type`   | `'multi'`                                                    | Yes      |             |
| `values` | `BucketLocationMulti`                                        | Yes      |             |
| `type`   | `'dual'`                                                     | Yes      |             |
| `values` | `BucketLocationDualOrSingle \| BucketLocationDualOrSingle[]` | Yes      |             |
| `type`   | `'single'`                                                   | Yes      |             |
| `values` | `BucketLocationDualOrSingle`                                 | Yes      |             |
| `type`   | `'global'`                                                   | Yes      |             |
| `values` | `never`                                                      | No       |             |

### `BucketLocationMulti`[​](#bucketlocationmulti "Direct link to bucketlocationmulti")

```
type BucketLocationMulti = (typeof multiRegions)[number];
```

### `BucketLocationDualOrSingle`[​](#bucketlocationdualorsingle "Direct link to bucketlocationdualorsingle")

```
type BucketLocationDualOrSingle = (typeof singleOrDualRegions)[number];
```

### `multiRegions`[​](#multiregions "Direct link to multiregions")

```
const multiRegions: readonly ["usa", "eur"];
```

### `singleOrDualRegions`[​](#singleordualregions "Direct link to singleordualregions")

```
const singleOrDualRegions: readonly [

  "ams",

  "fra",

  "gru",

  "iad",

  "jnb",

  "lhr",

  "nrt",

  "ord",

  "sin",

  "sjc",

  "syd",

];
```
