Skip to content

zidane/durable/node-fs

The file system of the durable JSONL storage on Node and Bun, through node:fs.

import { … } from 'zidane/durable/node-fs'src/durable/storage/fs-node.ts

Use nodeFileSystem to keep durable records as plain files on Node or Bun. Pass it to jsonlStorage from zidane/durable with a directory, then open the kernel on that storage. One process writes a directory at a time. A lock file names that process, and the storage refuses a second writer. Open with readOnly: true to read the directory while another process writes it. Commits are flushed to the disk by default (fsync). See durable tasks and hosts.

TypeScript
import { jsonlStorage, openDurable } from 'zidane/durable'
import { nodeFileSystem } from 'zidane/durable/node-fs'

const storage = jsonlStorage({ dir: './durable', fs: nodeFileSystem() })
const durable = await openDurable({ storage })
await durable.resumeLive()

Functions#

nodeFileSystemFunction#

A FileSystem on node:fs/promises. Paths are used as given.

TypeScript
function nodeFileSystem(): FileSystem

src/durable/storage/fs-node.ts:33