0.1.26 • Published 4 years ago
simple-ffdb v0.1.26
ffDb
A simple flat file database
ffDb makes several assumptions about typical use cases for small size, low maintenance, easy to setup databases.
All data stored is encrypted, either with a provided password or one will be generated automatically.
> npm install --save simple-ffdb
Basic Documentation
Simple Initialization
let Database = require("simple-ffdb");
let database = new Database("database_directory", password?);
if (!database.initialized) {
database.initialize() /* Generate folder and file structure in indicated directory */;
}
Command line initialization
$ node
> require("simple-ffdb").init(name, password?);
> .exit
Simple Usage
/* Create Table selects the created table for modification */
database.createTable("users", ["username", "password", "email"]);
/* Insert a row */
database.insertRow("richardred15", "password", "richardred15@gmail.com");
/* All row values are not required */
database.inserRow("eric", "password");
/* Insert with key/value pairs */
database.insertRow({
username: "foo",
email: "baz@example.com",
password: "bar"
})
/* Insert an empty row */
database.insertRow();
/* Set columns in a row where column value matches */
database.updateRows(
/* New Values */
{
password: "new_password"
},
/* Where column matches */
{
username: "richardred15"
}
)
/* Delete a row where columns have value, returns deleted rows */
let deleted = database.deleteRows({
username: "foo"
})
deleted:
[
{
username: 'foo',
password: 'bar',
email: 'baz@example.com'
}
]
database.selectTable("users")/* Switch to table */;
let user_data = database.searchColumn("username", "richardred15");
user_data:
[
{
username: 'richardred15',
password: 'new_password',
email: 'richardred15@gmail.com'
}
]
let rows = database.getRows();
rows:
[
[ 'richardred15', 'new_password', 'richardred15@gmail.com' ],
[ 'eric', 'password', '' ],
[ '', '', '' ]
]
0.1.26
4 years ago
0.1.25
4 years ago
0.1.24
4 years ago
0.1.23
4 years ago
0.1.22
4 years ago
0.1.21
4 years ago
0.1.20
4 years ago
0.1.19
4 years ago
0.1.18
4 years ago
0.1.17
4 years ago
0.1.16
4 years ago
0.1.15
4 years ago
0.1.14
4 years ago
0.1.13
4 years ago
0.1.12
4 years ago
0.1.11
4 years ago
0.1.10
4 years ago
0.1.9
4 years ago
0.1.8
4 years ago
0.1.7
4 years ago
0.1.6
4 years ago
0.1.4
4 years ago
0.1.3
4 years ago
0.1.5
4 years ago
0.1.0
4 years ago
0.1.2
4 years ago
0.1.1
4 years ago
0.0.15
4 years ago
0.0.12
4 years ago
0.0.14
4 years ago
0.0.11
4 years ago
0.0.1
4 years ago