@byteplus-iga-pages/blob
v1.0.2
Published
Server-only Blob Storage SDK for BytePlus IGA Pages
Readme
@byteplus-iga-pages/blob
The BytePlus IGA Pages server-side object storage SDK stores files, reports, model-generated artifacts, and JSON data.
Installation
npm install @byteplus-iga-pages/blobRequires Node.js 20+ and an BytePlus IGA Pages server runtime. For local development, link your project using the BytePlus IGA Pages CLI:
bp-iga pages link
bp-iga pages devThe SDK automatically uses the current project's runtime identity. No service endpoints, buckets, or credentials need to be configured in your code. Your application is responsible for authorizing user access to files.
Quick Start
import { blob } from "@byteplus-iga-pages/blob";
await blob.set("reports/daily.md", "# Daily report\nTask completed.", {
contentType: "text/markdown; charset=utf-8",
});
const text = await blob.get("reports/daily.md");
console.log(text);
await blob.setJSON("reports/status.json", { status: "done" });
const data = await blob.get<{ status: string }>("reports/status.json", {
format: "json",
});
console.log(data?.status);A key is an object name within the project, such as reports/daily.md. You do not need to create directories first. Keys cannot start or end with /, or contain empty path segments, . or .. path segments, backslashes, or NUL characters.
API Overview
| Method | Purpose |
| -------------------------------- | ------------------------------------------------------------- |
| set(key, body, options?) | Write text, binary data, or a stream |
| setJSON(key, value, options?) | Store JSON data |
| get(key, options?) | Read content as text by default |
| info(key, options?) | Get object metadata |
| list(options?) | List objects, optionally filtered by prefix |
| delete(key, options?) | Delete an object; repeated deletion succeeds |
| createUploadUrl(key, options?) | Generate a temporary upload ticket for direct browser uploads |
For parameter and return types, inspect the API's TypeScript definitions in your editor.
Blob Errors
BlobError.toJSON() returns { code, status?, message }.
License
See LICENSE for terms of use.
