Skip to content

@storyshelf/storage-local

View as Markdown

@storyshelf/storage-local is the default blob storage adapter for a single-node deployment. It stores screenshots, diff overlays, and uploaded Storybook archives below one data directory.

Terminal window
npm i @storyshelf/storage-local

JSR JSR Score

import { createLocalStorage } from "@storyshelf/storage-local";
import { createShelfApp } from "@storyshelf/app";
import { createSqliteDatabase } from "@storyshelf/db-sqlite";
const storage = createLocalStorage("./data");
const database = createSqliteDatabase("./data/shelf.db");
const app = createShelfApp({ database, storage });

createLocalStorage(dataDir: string): StorageAdapter

Section titled “createLocalStorage(dataDir: string): StorageAdapter”

Stores all blobs under the resolved dataDir (creating directories as needed). Paths are confined to the data directory — any path escaping it throws an error.

The returned adapter implements every method of the StorageAdapter interface (read, write, delete, exists, list(prefix)).

Use local storage with SQLite for a simple single-node deployment. For cloud or multi-node deployments where instances need shared objects, switch to S3 storage without changing the core router.