Use an in-memory filesystem with Effect. The packages cover the standard FileSystem service, direct access to a
shared virtual volume, SQLite persistence, and NFSv4.1 exports.
npm install @effect-vfs/memory@latest
npm install "@effect/platform-bun@$(npm view @effect-vfs/memory peerDependencies.effect)"import { MemoryFileSystem } from "@effect-vfs/memory"
import * as BunCrypto from "@effect/platform-bun/BunCrypto"
import { Effect, FileSystem } from "effect"
const program = Effect.gen(function*() {
const fs = yield* FileSystem.FileSystem
yield* fs.writeFileString("/settings.json", JSON.stringify({ mode: "preview" }))
return yield* fs.readFileString("/settings.json")
})
const settings = await Effect.runPromise(
program.pipe(Effect.provide(MemoryFileSystem.layer), Effect.provide(BunCrypto.layer))
)
console.log(settings) // {"mode":"preview"}The program uses Effect's FileSystem service. layer provides a fresh virtual volume and requires an Effect Crypto service.
- Use
@effect-vfs/memorywhen existing Effect code needs aFileSystem.FileSystemimplementation. This is the usual starting point. - Use
@effect-vfs/corewhen you need byte-preserving names, explicit callers and permissions, shared volumes, fixtures, quotas, watches, or portable snapshots. - Use
@effect-vfs/nodefor a direct Node 26.11.1VirtualProviderover a synchronous shared volume. Mounted integration remains separate. - Use
@effect-vfs/persistencefor named SQLite checkpoints or experimental live image commits. - Use
@effect-vfs/nfsto expose one live volume through the preview read-only NFSv4.1 profile or the experimental writable profile with qualified storage. It is not a conformant or production NFS server.
The package declares the exact Effect version it supports as a peer dependency. Check that requirement before upgrading an existing Effect installation.
For architecture and behavioral contracts, start with the project knowledge overview.
bun install
bun run type-check
bun run test
bun run build- Getting started runs a program with the memory adapter.
- Testing guide covers isolated and seeded tests.
- Confine a workspace gives a caller access within one directory.
- Snapshot search finds filenames and content in captured state.
- Overlay guide combines independent edits with snapshot deltas.
- Agent toolkit and MCP demo exposes a disposable virtual workspace through MCPJam.
- Virtual build example runs Vite over virtual files.
Reference repositories under .reference/ are optional and excluded from builds.
MIT