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

datason

v2.0.0

Published

A database based on JSON files on your filesystem

Downloads

4

Readme

Datason

test

A database consisting of json files on disk.

Every table is a directory and every object is a json file... the way it should be.

Docs

Saving an object is easy.

const db = require("datason");

db.connect("<path to db dir>").then((db) => {
  db.createTable("table");
  db.table.register("id", { data: "hello world" });
});

The object will then be created and accessible via dot notation, i.e. db.table.id.data.data === "hello world"

Updating a registered object is super easy!

table.register("id", { data: "hello world" });
table.id.data.data = "hello universe";
table.id.data.data.save.then((_) => console.log("save complete"));

Loading should never be explicitly required so when calling connect it will load the database into memory.

Index

A table can be time indexed if desired like so:

db.createTable("time", { index: Index.TIME });

It will then keep an index of when all the entries are added. The index consists of buckets containing the IDs. By default the bucket size is 50 and it is used as a rough filtering for when the index is queried.

The time index can be queried like this to get everything inserted the past second:

db.get("time").getFrom(new Date().getTime() - 1000);