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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@swapnaneelr/data-store

v1.0.0

Published

Node.js data store with persistent, transient, and secure storage

Readme

Data Store

This is a javascript based implementation of a data store that can be used to store and retrieve data. It is implemented as a singleton class that uses the node-persist library for the persistent store and node-cache for the transient store. The secure store is implemented using the keytar library. The data store can be configured to enable or disable user scoping, logging, and other features. It also supports TTL (time to live) for the transient store and the persistent store. The Persistent store also has a write queue feature that allows for asynchronous writes to the persistent store. The data store can be used in a variety of applications, including web applications, desktop applications, and mobile applications.

Usage

To use the data store, you can import the DataStore class and create an instance of it. You can then create a config file that would be used to initialize the data store. The config file should be a JSON that contains the following keys:

const storeConfig = {
  store: {
    enableUserScoping: true,
    userId : userId,
    isLoggingEnabled : true,
    logger : log 
  },
  persistent: {
    dir: persistentStoreDir,
    stringify: JSON.stringify,
    parse: JSON.parse,
    encoding: "utf8",
    logging: false,
    ttl: false,
    expiredInterval: 2 * 60 * 1000,
    forgiveParseErrors: false,
    writeQueue: true,
    writeQueueIntervalMs: 1000,
    writeQueueWriteOnlyLast: true
  },
  transient: {
    ttl: 1200
  },
  secure: {
    serviceName: appName
  }
};

You can then initialize the data store with the config file and use it to store and retrieve data. For example:

const dataStore = new DataStore();
await dataStore.init(storeConfig);

You can then use the set and get methods to store and retrieve data. For example:

await dataStore.persistent.set("key", "value");
const value = await dataStore.persistent.get("key");
console.log(value); // "value"

You can also use the transient and secure stores in a similar way. For example:

await dataStore.transient.set("key", "value123");
const value = await dataStore.secure.get("cognitoKey"); 

The store config can be customized to enable or disable user scoping, logging, and other features. You can also specify the directory for the persistent store and the encoding for the data. The data store is designed to be flexible and can be used in a variety of applications. It provides a simple API for storing and retrieving data, and it can be easily integrated into your application.

License

MIT License