Storage
The Fynd Boltic SDK exposes account storage through client.storage: list objects under a prefix, upload files, create folders, change public/private access, and download file contents. Configuration matches other SDK services (region, environment, and so on).
import { createClient } from "@boltic/sdk";
const client = createClient("your-api-key");
// All storage operations
const storage = client.storage;
What you can do
- List — Browse files and folders under a
basePathprefix; each row is normalized to a fixed set of fields (see List). - Upload — Send a
Blob+ filename; control visibility withpublicandexpire_in(see Upload). - Create folder — Create an empty prefix path (see Create folder).
- Delete — Remove an object by full path (see Delete file).
- Access —
makePublic/makePrivatewith a compact summary response (see Public & private). - Download — Read full file bytes for a path (see Download file).
Core functions
| Function | Description |
|---|---|
list(params?) | List objects under an optional folder prefix |
upload(params) | Upload a file (Blob + options) |
createFolder(params) | Create a folder path |
deleteFile(params) | Delete by full object path |
makePublic(filePath) | Make object publicly readable |
makePrivate(filePath) | Make object private |
downloadFile(params) | Download bytes for an object |
Client configuration
Pass options as the second argument to createClient so storage calls hit the correct environment:
| Option | Type | Description |
|---|---|---|
region | 'asia-south1' or 'us-central1' | Regional host (default asia-south1) |
environment | 'local', 'sit', 'uat', or 'prod' | Deployment environment |
debug | boolean | Verbose request logging |
const client = createClient(process.env.BOLTIC_API_KEY!, {
region: "asia-south1",
environment: "prod",
debug: false,
});
Response shape
Every method returns either success data or a BolticErrorResponse. Prefer the type guard isErrorResponse from @boltic/sdk:
import { createClient, isErrorResponse } from "@boltic/sdk";
const result = await client.storage.list({ basePath: "app/" });
if (isErrorResponse(result)) {
console.error(result.error.message);
return;
}
const rows = result.files?.data ?? [];
You can also check "error" in result && result.error if you avoid the helper.
Success and error types (conceptual)
// Success — shape depends on the method (list, upload, etc.)
// Error
interface BolticErrorResponse {
error: {
code: string;
message: string;
meta?: string[];
};
}
Quick example
import { createClient, isErrorResponse } from "@boltic/sdk";
const client = createClient("your-api-key");
const listed = await client.storage.list({ basePath: "" });
if (!isErrorResponse(listed)) {
console.log(listed.files?.data?.length ?? 0, "items");
}
End-to-end pattern
Typical flow: ensure a prefix exists → upload → list → optionally download or change access.
import { createClient, isErrorResponse } from "@boltic/sdk";
const client = createClient("your-api-key");
const prefix = "my-app/invoices/";
// 1) Folder (optional if uploads create prefixes automatically)
const folder = await client.storage.createFolder({ folder_path: prefix.replace(/\/$/, "") });
if (isErrorResponse(folder)) throw new Error(folder.error.message);
// 2) Upload
const blob = new Blob([JSON.stringify({ ok: true })], { type: "application/json" });
const up = await client.storage.upload({
file: blob,
filename: `invoice-${Date.now()}.json`,
filepath: prefix,
});
if (isErrorResponse(up)) throw new Error(up.error.message);
const objectPath = up.path;
// 3) List
const listed = await client.storage.list({ basePath: prefix });
if (isErrorResponse(listed)) throw new Error(listed.error.message);
// 4) Download (use full path from upload or list `fullPath`)
const dl = await client.storage.downloadFile({ file_name: objectPath });
if (isErrorResponse(dl)) throw new Error(dl.error.message);
const bytes = dl.bytes;
Paths: rules of thumb
basePathforlist— folder prefix, often trailing slash (e.g."exports/").filepathforupload— prefix under which the file is stored; combine withfilenamefor the logical object.path/fullPathfrom responses — use these fordeleteFile({ filename }),downloadFile({ file_name }),makePublic/makePrivate— must match the full object path in storage.
For builders and AI assistants
Use this checklist when implementing or generating code:
- Import —
createClientfrom@boltic/sdk; useisErrorResponseafter every storage call unless you wrap errors elsewhere. - List — Pass
basePathto scope listing; readresult.files?.dataand usefullPath,isDirectory,size,updatedAtas needed. - Upload — Provide
file(Blob) andfilenameorfile_name(logical name). Setpublic/expire_infor visibility; readpathand optionaltemporary_sharable_link/public_url. - Delete / download / access — Always use the full storage path for that object (same as list
fullPathor uploadpath). - Download — Pass
file_namewith the full path. If you already know the size from a previous list, passsizeBytesso the client does not need to resolve it. - makePublic / makePrivate — Returns
ObjectAccessSummary:message,name,size,updated,public.
Use only the client.storage methods documented in this section.
Related pages
- List — Parameters and pagination
- Upload — Visibility and response fields
- Create folder
- Delete file
- Public & private
- Download file
📄️ List
List files and folders in storage with the Fynd Boltic SDK — client.storage.list
📄️ Upload
Upload files with client.storage.upload in the Fynd Boltic SDK
📄️ Create Folder
Create a folder prefix in storage with client.storage.createFolder
📄️ Delete File
Delete a stored object by full path with client.storage.deleteFile
📄️ Public & Private Access
Make storage objects public or private with client.storage.makePublic and makePrivate
📄️ Download File
Download file bytes from storage with client.storage.downloadFile