npm.io
2.0.5 • Published 5 years ago

fast-database

Licence
ISC
Version
2.0.5
Deps
1
Size
12 kB
Vulns
0
Weekly
0

Welcome to fast-database

Version Documentation Maintenance License: ISC

A small SQLite wrapper

Homepage

Install

Windows
$ npm install windows-build-tools -g 

$ npm i node-gyp -g

$ npm install fast-database --save
Linux
$ npm i node-gyp -g

$ npm install fast-database --save

Using

const Database = require("fast-database");

const db = new Database({
    path: "./db.sqlite", // path to database file (optional, default ./database.sqlite)
    table: "testing" // default table (optional, default master)
});

/* Basic usage */
const foo = db.get("foo");
console.log(foo) // null
const operation = db.set("foo", "bar");
console.log(operation) // true
const newFoo = db.get("foo");
console.log(newFoo) // bar

/* Using tables */

db.table("foo");

const operation = db.set("foo", "bar");
console.log(operation) // true
const newFoo = db.get("foo");
console.log(newFoo) // bar

const newFooFromOtherTable = db.table('bar').get('foo');
console.log(newFooFromOtherTable); // null !

Author

Aleks1123

Show your support

Give a ️ if this project helped you!

License

Copyright 2021 Aleks1123.
This project is ISC licensed.


Keywords