@xuhaojun/rxdb-storage-pglite
v0.0.3
Published
rxdb storage for pglite
Downloads
51
Maintainers
Readme
RxDB PgLite
This is a plugin for RxDB that allows you to use PgLite as a storage engine.
Installation
npm install @xuhaojun/rxdb-storage-pglite @electric-sql/pglite
Usage
import { getRxStoragePGLite } from "@xuhaojun/rxdb-storage-pglite";
// nodejs with local file storage
const myDatabase = await createRxDatabase<YourCollections>({
name: "test",
storage: getRxStoragePGLite({ path: path.join(__dirname, "test.db") }),
});
// browser with indexedDB storage
const myDatabase = await createRxDatabase<YourCollections>({
name: "test",
storage: getRxStoragePGLite({ path: "idb://test" }),
});
// expo with expo-file-system
import * as FileSystem from "expo-file-system";
const myDatabase = await createRxDatabase<YourCollections>({
name: "test",
storage: getRxStoragePGLite({
path: FileSystem.documentDirectory + "test.db",
}),
});