@markwylde/eventbase
Version:
A distributed, event-sourced, key-value database built on top of **NATS JetStream**. Eventbase provides a simple yet powerful API for storing, retrieving, and subscribing to data changes, with automatic state synchronization across distributed instances a
15 lines • 539 B
JavaScript
import createDoubledb from 'doubledb';
import { join } from 'path';
import { mkdir } from 'fs/promises';
import { tmpdir } from 'os';
export async function createDb(streamName, dbPath) {
const path = dbPath
? join(dbPath, `doubledb-${streamName}`)
: join(tmpdir(), `doubledb-${streamName}`);
// Ensure the directory exists
await mkdir(dbPath || tmpdir(), { recursive: true });
// Open existing DB or create a new one
const db = await createDoubledb(path);
return db;
}
//# sourceMappingURL=db.js.map