1.2.2 • Published 6 years ago

bytebase v1.2.2

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

ByteBase

A simple database framework that uses bytebuffer to store data tables in binary.

Usage

var ByteBase = require('bytebase');
var bytebase = new ByteBase('database'); // 'database' is any directory name

Create and append to a new table

let tablename = 'dogs';
let labels = ['legs', 'weight', 'height', 'length'];
let types = [ ByteBase.TYPE_BYTE,
              ByteBase.TYPE_FLOAT,
              ByteBase.TYPE_FLOAT,
              ByteBase.TYPE_FLOAT ];
let scruffy = [1, 23.15, 2.42, 3.68];
let wiggles = [4, 13.62, 1.01, 7.59];
let patches = [2, 180.6, 6.12, 2.14];

// create and open table for writing
bytebase.createTable(tablename, labels, types);
bytebase.initTable(tablename, true);
bytebase.print(); // prints all table keys to console

// append a bunch of dogs and then end the writeStream
bytebase.append(tablename, scruffy);
bytebase.append(tablename, wiggles);
bytebase.append(tablename, patches);
bytebase.endWriting(tablename).then((result) => {
    // called when writing finishes
});

Access an existing table

let start = 1, numRows = 2;
byteBase.initTable(tablename);
bytebase.iterate(tablename, (vals) => {
    for (let i=0; i<vals.length; i++)
        console.log(labels[i]+': '+vals[i]);
}, start, numRows);
1.2.2

6 years ago

1.2.1

6 years ago

1.1.14

6 years ago

1.1.13

6 years ago

1.1.12

6 years ago

1.1.11

6 years ago

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago