file
@noy-db/to-file·pnpm add @noy-db/to-fileLocal disk / USB stick storage, one JSON file per record.
| Shape | record |
| Atomic CAS | ✗ |
| Locality | local |
| Speed | fast |
| Persistence | durable |
What it does
Lays a vault out as plain files — {dir}/{vault}/{collection}/{id}.json, one
pretty-printed encrypted envelope per record — inspectable (but not readable) with
any editor. Good for USB-stick workflows (air-gapped portability), local-first
desktop apps, network-drive sharing with per-user secrets, and backup-friendly
storage.
Notes
- No compare-and-swap primitive at the filesystem layer —
casAtomic: false. - Record shape by default; also ships
savePod/loadPodfor whole-vault.noydbbundle files, andexportBlobsToDirectorywith target-profile filename sanitization and Zip-Slip path containment. - Factory:
toFile(options: JsonFileOptions).
Store-locator descriptor
See store-locator descriptors for the general model —
this store is the seam's local-class reference implementation. kind: 'file', class: 'local'. Unlike the rest of the family, fileStoreDescriptor
takes the base directory directly rather than an address object:
fileStoreDescriptor(dir: string): StoreDescriptor — internally
address is { dir }. No options. to-file is credentialless, so
credentials is unused; binding may carry a device-local directory
override — a bare string or { dir } — applied in place of the descriptor's
dir (e.g. a different mount point on this device).
import { fileStoreDescriptor, registerFileStore } from '@noy-db/to-file'
const descriptor = fileStoreDescriptor('./data')
// later, on a different device: locator.resolve(descriptor, { binding: '/mnt/usb/data' })