Getting Started
Installation
pnpm add @anymux/unionBasic Usage
import { UnionFileSystem } from "@anymux/union";
import { MemoryFileSystem } from "@anymux/file-system/mem-fs";
const base = new MemoryFileSystem();
const overlay = new MemoryFileSystem();
const fs = new UnionFileSystem({ layers: [overlay, base] });
// Writes go to the first (highest priority) layer
await fs.writeFile("/hello.txt", new TextEncoder().encode("Hello!"));
// Reads check layers in order
const content = await fs.readFile("/hello.txt");