Skip to content

About

Effect-native virtual filesystem packages: a runtime-neutral core and an in-memory FileSystem implementation.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

523 Commits

Folders and files

Repository files navigation

Effect VirtualFileSystem

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.

Quick start

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.

Choose a package

  • Use @effect-vfs/memory when existing Effect code needs a FileSystem.FileSystem implementation. This is the usual starting point.
  • Use @effect-vfs/core when you need byte-preserving names, explicit callers and permissions, shared volumes, fixtures, quotas, watches, or portable snapshots.
  • Use @effect-vfs/node for a direct Node 26.11.1 VirtualProvider over a synchronous shared volume. Mounted integration remains separate.
  • Use @effect-vfs/persistence for named SQLite checkpoints or experimental live image commits.
  • Use @effect-vfs/nfs to 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.

Repository development

bun install
bun run type-check
bun run test
bun run build

Examples and documentation

Reference repositories under .reference/ are optional and excluded from builds.

License

MIT

About

Effect-native virtual filesystem packages: a runtime-neutral core and an in-memory FileSystem implementation.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages