Basic put/get operations
Basic put/get operations
import { createIndexedDB } from "@anabranch/storage-browser"; import { Storage } from "@anabranch/storage"; const connector = createIndexedDB({ prefix: "app/" }); const storage = await Storage.connect(connector).run(); await storage.put("config.json", JSON.stringify({ theme: "dark" })).run(); const { body, metadata } = await storage.get("config.json").run();
Stream listing with concurrent processing
Stream listing with concurrent processing
const storage = await Storage.connect(createIndexedDB()).run(); await storage.put("users/1.json", '{"name": "Alice"}'); await storage.put("users/2.json", '{"name": "Bob"}'); const { successes } = await storage.list("users/") .withConcurrency(5) .map(async (entry) => await processEntry(entry)) .partition();