@signaldb/opfs
createOPFSAdapter (default
)
js
import createOPFSAdapter from '@signaldb/opfs'
import { Collection } from '@signaldb/core'
const collection = new Collection({
persistence: createOPFSAdapter('path/to/db.json'),
})
Function to create a OPFS adapter for use with a collection. The OPFS Adapter is another way to store data in a browser environment. This adapter is based on the Origin Private File System API. It is a simple and straightforward way to store data in the browser's filesystem. The only thing required is to specify the desired filename for each file.
The OPFS Adapter is an alternative to the Filesystem Adapter. The OPFS Adapter can only be used in a browser environment, while the Filesystem Adapter can only be used in a Node.js environment.
Credits to jamesgibson14