libstorage

libstorage - Storage abstraction layer. createStorage factory returns backend based on environment (local, S3, Supabase). LocalStorage, S3Storage, SupabaseStorage implement storage interface. parseJso

SKILL.md

GitHub

libstorage Skill

When to Use

  • Persisting data to filesystem or cloud storage
  • Supporting multiple storage backends
  • Reading/writing JSON and JSONL files
  • Building storage-agnostic applications

Key Concepts

Storage interface: Provides a common API (read, write, list, delete) for all supported storage systems.

createStorage: Factory that returns appropriate backend based on environment configuration.

JSONL support: Parse and serialize newline-delimited JSON for streaming data.

Usage Patterns

Pattern 1: Create storage instance

import { createStorage } from "@copilot-ld/libstorage";

const storage = createStorage(config);
await storage.write("data/file.json", { key: "value" });
const data = await storage.read("data/file.json");

Pattern 2: JSONL operations

import { parseJsonl, serializeJsonl } from "@copilot-ld/libstorage";

const items = parseJsonl(jsonlContent);
const output = serializeJsonl(items);

Integration

Used by all indexes and services. Backend configured via STORAGE environment.