UNPKG

@wxn0brp/db

Version:

A modular, embedded database for developers who want control over their data storage.

27 lines (26 loc) 586 B
#!/usr/bin/env node import { Valthera } from "./valthera.js"; const args = process.argv.slice(2); if (args.length < 2) { console.error(`Use: ${process.argv[1]} <path> <op> <collection> [args]`); process.exit(1); } const path = args.shift(); const op = args.shift(); const opts = args.map((arg) => { try { return JSON.parse(arg); } catch { return arg; } }); const db = new Valthera(path); try { const res = await db.c(opts.shift())[op](...opts); console.log(JSON.stringify(res)); } catch (e) { console.error(e); process.exit(1); }