GitHub avatar

Fox's Blog

← Back to projects

wasmfs

Node fs-like module backed by IndexedDB with a memory fallback when IndexedDB is unavailable.

Install

bun install

Test

bun test

Current API Coverage

Implemented (callback + delegated promises):

  • access / chmod
  • mkdir / readdir / readFile / writeFile / appendFile
  • rename / realpath / stat
  • unlink / rmdir / rm
  • copyFile / cp
  • truncate
  • open / close
  • read / write (buffer and string write forms)
  • fstat / ftruncate / fsync / fdatasync

Permissions model on virtual nodes:

  • read
  • write
  • execute

Sync API

Sync methods intentionally throw ENOTSUP with guidance to use fs.promises.*, because IndexedDB is asynchronous by nature.

Run Example

bun run index.ts