0.0.9 • Published 1 year ago

datadots v0.0.9

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
1 year ago

Data Dots

Handle thousands of tiny json data "dots".

icon

DataDots is a plain, reasonably powered, database of JSON-files.

Motivation

  • Being JSON-native makes data easy to work with and easy to debug and understand (all you need is a text editor).
  • Being append-only means the data is almost impossible to corrupt
  • Being text-based means it is easy to compress, share, and transmit
  • Being JSON, records are easy to rewrite/transform as the application grows and morphs.
  • Being file-based, it is easy to create per-user or per-tenant files and manage them naturally.

QuickStart

Install:

npm install datadots

Use:

import dots, { memoryPersister, browserPersister } from "datadots";
import diskPersister from "datadots/diskPersister";

const dot = await dots.setup("/path/to/datafile", {
    saveEvery: 5, // seconds
    persister: diskPersister(), // or memoryPersister or browserPersister or your own
});

Add Record:

const datum = { key: value, key2: value2 };
dot.add(datum);

Query Records:

dot.q((records) => {
    console.log(`There are ${records.length} records`);
});

Closing:

await dot.close();
await dots.shutdown();
0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago