You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

qjson-db

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qjson-db

Lightweight local JSON-based database for Node.js projects.

1.1.0
latest
Source
npmnpm
Version published
Weekly downloads
67
179.17%
Maintainers
1
Weekly downloads
 
Created
Source

qjson-db

Lightweight local JSON-based database for Node.js projects.

Installation

npm install qjson-db

Usage

const JSONdb = require("qjson-db");
const db = new JSONdb("./data.json");

db.set("username", "Qpla");
console.log(db.get("username")); // "Qpla"

Options

  • asyncWrite — Enables asynchronous write to disk (default: false)
  • syncOnWrite — Writes changes to disk immediately after modification (default: true)
  • jsonSpaces — Number of spaces to use for JSON formatting (default: 4)

API

new JSONdb(filePath[, options])

Creates a new database instance.

  • filePath (string) — Path to the JSON file (extension .json will be added if missing)
  • options (object, optional):
    • asyncWrite (boolean)
    • syncOnWrite (boolean)
    • jsonSpaces (number)
    • stringify (function)
    • parse (function)

Methods

  • init(key, value) — Initializes a key with a value if it doesn't exist.
  • set(key, value) — Sets or updates a key with a value.
  • get(key) — Retrieves the value by key.
  • has(key) — Checks if a key exists.
  • delete(key) — Deletes a key. Returns true if deleted, undefined if not found.
  • deleteAll() — Deletes all keys.
  • sync() — Writes current storage to disk.
  • JSON([storage]) — Gets a clone of the storage or replaces storage if an object is passed.

License

MIT

Made with ❤️

Keywords

json

FAQs

Package last updated on 19 Jul 2025

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