@signaldb/fs
createFileSystemAdapter (default
)
js
import createFileSystemAdapter from '@signaldb/fs'
import { Collection } from '@signaldb/core'
const collection = new Collection({
persistence: createFileSystemAdapter('path/to/db.json'),
})
Function to create a file system adapter for use with a collection. In a Node.js environment, we don't have access to local storage for data preservation. Instead, we resort to saving our data as plain JSON files, which effectively serves as a way to persist collection items. All that's required from you is to specify the desired filename for each file.