npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dbdjs.db

v2.0.2

Published

dbdjs.db - JSON Database with Speed and Optimization.

Downloads

2,239

Readme

dbd.js

dbdjs.db

Discord Server NPM Downloads NPM Version

Table Of Contents

About

dbdjs.db is a JSON Database meant for quick and easy saving data values.

Setup

const DBDJSDB = require("dbdjs.db");
const db = new DBDJSDB.Database({
  path: "database",
  tables: {{
    name: "test",
  }},
});

db.once("ready", () => {
  console.log("Database ready!");
});

db.connect();

Set

await db.set("test", "apple", "turtle.");
await db.set("test", "leref", "dbdjs.db owner");

Get

const apple = await db.get("test", "apple");
const leref = await db.get("test", "leref");

Get All

const lerefAndApple = await db.all("test", {
  filter: ({ data }) => data.key.includes("w"),
});

Delete

await db.delete("test", "apple");
await db.delete("test", "leref");

API

#Database

| Params | Description | | :--- | ---: | | options: DatabaseOptions | The database constructor to make a new database instance. |

  • #set() | Params | Return | Description | | :--- | :---: | ---: | | table: string, key: string, value: any | Promise<boolean> | Set method for the database. |
  • #get() | Params | Return | Description | | :--- | :---: | ---: | | table: string, key: string | Promise<Data> | Get method for the database. |
  • #all() | Params | Return | Description | | :--- | :---: | ---: | | table: string, options: AllOptions | Promise<AllData[]> | GetAll method for the database. |
  • #delete() | Params | Return | Description | | :--- | :---: | ---: | | table: string, key: string | Promise<boolean> | Delete method for the database. |

Interfaces

Database Options

| Property | Value | Default | Description | | :--- | :---: | :---: | ---: | | tables | Table[] | | The reserved tables for the database. | | path? | string | "database" | Path to main database folder. | | maxFileData? | number | 50000 | The max data that a file can store. | | debug? | boolean | false | Whether the database should send debug log events. | | extension? | string | ".sql" | The extension for each file in the database. | | force? | boolean | false | Whether to force the database to save or delete data on the file. | | cache? | number | 3000 | How many data can the database store in memory cache. | | timestamp? | boolean | false | Whether the database should save timestamp for each data. | | saveTime? | number | 100 | How long until the database can save the data into file (ms). | | getTime? | number | 1 | How long until the database pull a data from file (ms). | | allTime? | number | 100 | How long until the database pull some data from file (ms). | | deleteTime? | number | 100 | How long until the database delete a data from file (ms). | | cacheRouters? | boolean | true | Whether the database should cache data routers on startup. |

Table

| Property | Value | Description | | :--- | :---: | ---: | | name | string | Name for the table, this will also define the path to this table file. |

Data

| Property | Value | Description | | :--- | :---: | ---: | key | string | The key of the data. | | value | any | The value of the data. | | ttl? | number | The ttl for the data. | | createdAt? | number | The time which this data was created. | | updatedAt? | number | The time which this data was last updated. |

All Options

| Property | Value | Description | | :--- | :---: | ---: | | filter | (allData: AllData) => boolean | The function to filters data. |

All Data

| Property | Value | Description | | :--- | :---: | ---: | | key | string | The key of the data. | | data | Data | The data object of the data. |

Links

dbdjs.db was created for dbd.js now available for anyone to learn and use.