README.md
951 B · sha256:3ae2db9ff9db022324fade905692a5c77e4ac052d01a46454eb8f6b472a4e6bd
# SQLite storage
`rune add @rune/sqlite`
Use a pathname, a file URL, or `:memory:` in tests. The adapter uses Node’s built-in SQLite module. Keep the database on local persistent storage. It enables WAL and retries a busy database for up to five seconds.
```typescript
import { connect } from "@rune/sqlite";
import { document } from "@rune/storage";
const db = await connect("./server.sqlite");
const visits = document(db.store, "visits", () => ({ total: 0 }));
await visits.update((value) => ({ total: value.total + 1 }));
// Call await db.close() when the connection is no longer needed.
```
Wrap an existing driver instance with `sqliteStore(database)`.
Use `db.store` with Web Auth, or as a general-purpose record store.
Pass `{ name: "shared" }` to `connect` to make the existing connection
reusable by other Runes. [Storage configuration](https://github.com/Rune-MC/rune/tree/main/packages/storage#share-an-open-database-on-paper)