🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

datadots

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datadots

Store data records in separate JSON data "dots"

0.0.9
latest
Version published
Weekly downloads
3
-50%
Maintainers
0
Weekly downloads
 
Created

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();

FAQs

Package last updated on 04 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts