stable

file

JSON file adapter for noy-db — encrypted document store on local disk, USB sticks, or network drives.

@noy-db/to-file · pnpm add @noy-db/to-file Local disk / USB stick storage, one JSON file per record.

Shaperecord
Atomic CAS✗
Localitylocal
Speedfast
Persistencedurable

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 / loadPod for whole-vault .noydb bundle files, and exportBlobsToDirectory with 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' })

See also