# bytebase

> Minimalist data storage

Latest version **1.2.2** (published 2018-08-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install bytebase
pnpm add bytebase
yarn add bytebase
bun add bytebase
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2018-08-17 |
| First published | 2018-06-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 13.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jackson Rain |
| Maintainers | jackson.rain |

## Links

- npm: https://www.npmjs.com/package/bytebase
- npm.io page: https://npm.io/package/bytebase

## Dependencies (1)

- [bytebuffer](https://npm.io/package/bytebuffer.md) ^5.0.1

## Recent versions

- 1.2.2 (latest) — 2018-08-17
- 1.2.1 — 2018-08-15
- 1.1.14 — 2018-08-14
- 1.1.13 — 2018-08-09
- 1.1.12 — 2018-08-09
- 1.1.11 — 2018-08-09
- 1.1.10 — 2018-07-23
- 1.1.9 — 2018-07-23
- 1.1.8 — 2018-07-23
- 1.1.7 — 2018-07-23
- 1.1.6 — 2018-07-23
- 1.1.5 — 2018-06-29
- 1.1.4 — 2018-06-29
- 1.1.3 — 2018-06-29
- 1.1.1 — 2018-06-28
- … 7 more at https://npm.io/package/bytebase/versions

## README

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

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

### Create and append to a new table
```javascript
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
```javascript
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);
```

---
_Source: https://npm.io/package/bytebase · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
