Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@alcalzone/jsonl-db

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alcalzone/jsonl-db

Simple JSONL-based key-value store

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.6K
decreased by-62.17%
Maintainers
1
Weekly downloads
 
Created
Source

jsonl-db

Simple JSONL-based key-value store. Uses an append-only file to store the data. With support for database dumps and compressing the db file.

Build Status Coverage Status Language grade: JavaScript node npm

Usage

Load the module:

import { DB } from "@alcalzone/jsonl-db";

Open or create a database file:

const db = new DB("/path/to/file");
await db.open();

Use the database like you would use a Map.

The data is persisted asynchronously, so make sure to close() the DB when you no longer need it:

await db.close();

To create a compressed copy of the database in /path/to/file.dump, use the dump() method. If any data is written to the db during the dump, it is appended to the dump but most likely compressed.

await db.dump();

After a while, the main db file may contain unnecessary entries. To remove them, use the compress() method.

await db.compress();

Note: During this call, /path/to/file.dump is overwritten and then renamed, /path/to/file.bak is overwritten and then deleted. So make sure you don't have any important data in these files.

Changelog

0.1.1 (2020-04-25)

  • Fixed some race conditions

0.1.0 (2020-04-25)

First official release

Keywords

FAQs

Package last updated on 25 Apr 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc