Skip to main content

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

ParameterTypeRequiredDescription
basePathstringFolder prefix to list under (e.g. "exports/")
storageTypestringOptional storage variant (defaults apply when omitted)
pageSizenumber or stringPage size
nextPageTokenstringToken for the next page

Return Value

On success, files contains data (array of normalized rows) and optional next_page_token, totalCount.

StorageListItem (normalized)

FieldDescription
nameObject name
pathPath segment
folderNameFolder name when applicable
parentPathParent prefix
isDirectorytrue if folder
isPublicPublic visibility
cdnUrlCDN URL when public
fullPathFull object key in bucket
sizeSize string (files)
updatedAtLast 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.