Loading...
Loading...
Guide for using Netlify Blobs object storage. Use when storing files, images, documents, or simple key-value data without a full database. Covers getStore(), CRUD operations, metadata, listing, deploy-scoped vs site-scoped stores, and local development.
npx skill4agent add netlify/context-and-tools netlify-blobsnpm install @netlify/blobsimport { getStore } from "@netlify/blobs";
const store = getStore({ name: "my-store" });
// Use "strong" consistency when you need immediate reads after writes
const store = getStore({ name: "my-store", consistency: "strong" });// String or binary data
await store.set("key", "value");
await store.set("key", fileBuffer);
// With metadata
await store.set("key", data, {
metadata: { contentType: "image/png", uploadedAt: new Date().toISOString() },
});
// JSON data
await store.setJSON("key", { name: "Example", count: 42 });// Text (default)
const text = await store.get("key"); // string | null
// Typed retrieval
const json = await store.get("key", { type: "json" }); // object | null
const stream = await store.get("key", { type: "stream" });
const blob = await store.get("key", { type: "blob" });
const buffer = await store.get("key", { type: "arrayBuffer" });
// With metadata
const result = await store.getWithMetadata("key");
// { data: any, etag: string, metadata: object } | null
// Metadata only (no data download)
const meta = await store.getMetadata("key");
// { etag: string, metadata: object } | nullawait store.delete("key");const { blobs } = await store.list();
// blobs: [{ etag: string, key: string }, ...]
// Filter by prefix
const { blobs } = await store.list({ prefix: "uploads/" });getStore()getDeployStore()| Limit | Value |
|---|---|
| Max object size | 5 GB |
| Store name max length | 64 bytes |
| Key max length | 600 bytes |
@netlify/vite-pluginnetlify dev@netlify/vite-pluginnetlify dev