List
List objects under an optional folder prefix with pagination support using client.storage.list().
Function Signature
client.storage.list(params?: ListStorageParams): Promise<ListStorageData | BolticErrorResponse>
Parameters
ListStorageParams
| Parameter | Type | Required | Description |
|---|---|---|---|
basePath | string | ❌ | Folder prefix to list under (e.g. "exports/") |
storageType | string | ❌ | Optional storage variant (defaults apply when omitted) |
pageSize | number or string | ❌ | Page size |
nextPageToken | string | ❌ | Token for the next page |
Return Value
On success, files contains data (array of normalized rows) and optional next_page_token, totalCount.
StorageListItem (normalized)
| Field | Description |
|---|---|
name | Object name |
path | Path segment |
folderName | Folder name when applicable |
parentPath | Parent prefix |
isDirectory | true if folder |
isPublic | Public visibility |
cdnUrl | CDN URL when public |
fullPath | Full object key in bucket |
size | Size string (files) |
updatedAt | Last update time |
Example
import { createClient, isErrorResponse } from "@boltic/sdk";
const client = createClient("your-api-key");
const result = await client.storage.list({ basePath: "my-app/uploads/" });
if (isErrorResponse(result)) {
console.error(result.error.message);
} else {
const rows = result.files?.data ?? [];
for (const row of rows) {
console.log(row.fullPath, row.isDirectory, row.size);
}
}
Pagination
When the result includes next_page_token, pass it as nextPageToken on the next call to continue listing.
let token: string | undefined;
do {
const result = await client.storage.list({
basePath: "my-app/",
pageSize: 50,
nextPageToken: token,
});
if (isErrorResponse(result)) break;
const page = result.files?.data ?? [];
token = result.files?.next_page_token;
// process page…
} while (token);
Error handling
Check failures with isErrorResponse(result) before reading result.files.
Related
- Overview — Concepts and paths
- Upload — Add files under a prefix
- Download file — Needs
fullPathfrom list forfile_name