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 🙏

© 2025 – Pkg Stats / Ryan Hefner

cord-db

v1.0.2

Published

A lightweight and simple JSON-based database for Discord bot data management.

Readme

Cord-DB

A simple Node.js class for managing JSON data storage. It allows saving, loading, updating, and deleting JSON data.

Installation

To use this package, make sure you have Node.js installed, then run:

npm install cord-db

Usage

1. Importing the Package

const DataManager = require('cord-db');

2. Creating an Instance

You can specify the file path where your JSON data will be stored (default is ./data.json).

const db = new DataManager('./path-to-your-data-file.json');

3. Saving Data

To save data (an object) to the JSON file:

const data = { name: "John", age: 30 };
db.save(data);

4. Loading Data

To load the data from the JSON file:

const loadedData = db.load();
console.log(loadedData);

If the file doesn't exist or is empty, it will return null.

5. Updating a User's Key

You can update a specific user's data by specifying the userId, key, and value.

db.updateUserKey(userId, 'coins', amount);

This will update the coins field for the user with ID 1234567890 with new amount.

6. Retrieving a User's Key

To get the value of a specific key for a user:

const userCoins = db.getUserKey('user123', 'coins');
console.log(userCoins);
const coins = db.getUserKey(userId, 'coins') ||  0;
console.log(coins);

If the key doesn't exist for the user, it will return null.

7. Deleting the Data File

To delete the entire data file:

db.delete();

This will remove the file where your data is stored.

Methods Summary

  • save(data): Saves the provided data (object) to the JSON file.
  • load(): Loads and returns the data from the JSON file.
  • updateUserKey(userId, key, value): Updates a specific key-value pair for a user.
  • getUserKey(userId, key): Retrieves a specific key's value for a user.
  • delete(): Deletes the JSON file.

Error Handling

If any error occurs during file operations (e.g., file doesn't exist, permission issues), an error message will be logged to the console.


Visit Developer Support Server for any question or error! Created by .rya8 Enjoy managing your JSON data with ease!