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

corny-database

v1.0.7

Published

A really memory intensive database

Downloads

14

Readme

Corny-Database

This is a really redneck, incredibly simple, database written in JS . It stores all data in memory, but is fast when retrieving/writing data. Should you use this over something like MongoDB? Definitely not for large scale applications that will be storing a lot of data, but maybe for smaller programs where keeping all the data in memory won't hurt. And yes this does have persistent storage through json files.

So how does it work?

The only export present in this package is the class "Database"

const Database = require('corny-database');

To use the database simply assign it a name to be loaded/saved as.

const db = new Database("database-main");

Each database is organized into a hierarchical tree similar to that of an object in JSON. To store something in it, simply do.

db.setData(value, 'foo', 'bar', 'foobar');

This would create an object akin to

const obj =
{
  foo:
  {
    bar:
    {
      foobar: value
    }
  }
};

in your database. To get the value there, simply use

db.getData('foo', 'bar', 'foobar');

You can also get the object containing other values in the database by doing:

db.getData('foo', 'bar');

Be mindful of modifying this however, as doing so will not save the database unless another db.setData() is called or db.save() is called.

To check if the database contains a value or category you can do this check:

database.containsData('foo', 'bar', 'foobar');

You can get all the data in the database (modifying this is not reccomended) by just doing "db.data", and set it by saying "db.data = ...;". This will also save the database. The datafile this database is saved to can be found by getting db.dataFile.

Backups

To backup your database, you can use the function

db.backup(callback);

This will create a folder with the database name suffixed with -backup.