# zidane/durable/node-fs

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

Import: `import { … } from 'zidane/durable/node-fs'`. Source: [src/durable/storage/fs-node.ts](https://github.com/Tahul/zidane/blob/main/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`](https://zidane.si/docs/reference/durable.md) 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](https://zidane.si/docs/durable-kernel.md).

```ts
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

### `nodeFileSystem`

Function.

A [`FileSystem`](https://zidane.si/docs/reference/durable.md#FileSystem) on `node:fs/promises`. Paths are used as given.

```ts
function nodeFileSystem(): FileSystem
```

**Returns** `FileSystem`

Source: [src/durable/storage/fs-node.ts:33](https://github.com/Tahul/zidane/blob/main/src/durable/storage/fs-node.ts#L33)
