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

byteroo

v1.4.2

Published

Store data and configuration in Node.js

Readme

Byteroo

npm codecov

Byteroo is a key-value storage for your Node.js applications.

This library is heavily inspired by sindresorhus' conf, you might want to use their library instead of this one since it's more feature rich.

Usage:

const Byteroo = require('byteroo');
const storage = new Byteroo({
  name: 'mystorage',
  path: '/path/to/storage',
});
const container = storage.getContainerSync('users');
/* or
const container = await storage.getContainer('sync');
*/

| Property | Description | | ----------- | ----------------------------------------------------------------------------------------------- | | name | Name of your storage, used to automatically find a path in case it's not provided | | path | [optional] Path where all the containers will be stored, created automatically if doesn't exist | | serialize | [optional] Custom function to serialize the data object to a string | | deserialize | [optional] Custom function to deserialize string to data object | | autocommit | [optional] Automatically save data to disk on each change. Default: false |

// adding new value
container.set('[email protected]', 'value');

// retrieving a value
container.get('[email protected]'); // -> 'value'

// removing a value
container.remove('[email protected]');

// you can remove multiple values at once
container.remove('key1', 'key2', 'key3');

// saving data to disk
container.commit();

// checking if a property exists
container.has('[email protected]');

// deleting all items
container.clear();

// get amount of items
container.size();

// get list of items
container.list();

Storing data in memory

You can store your data in memory by using the IN_MEMORY_STORAGE constant exported by the module.

const constants = require('byteroo/constants');
{
  path: constants.IN_MEMORY_STORAGE;
}

This will disable the commit() function (you can still call it without any error) and the data won't be stored to disk.

Cache Container

Byteroo includes a container that can be used for caching purposes, you can retrieve it like this:

const container = storage.getContainerSync('users', { type: 'cache', ttl: 30 });
/* or
const container = await storage.getContainer('sync', { type: 'cache', ttl: 30 });
*/

| Property | Description | | -------- | --------------------------------------------------------------------------------------------- | | type | Type of the container ('default'/'cache'), in this case we use cache | | ttl | Timeout after which the entries are considered expired (not available in 'default' container) |

CacheContainer can be interacted with in the same way that the normal Container does, in fact it's an extended class of the Container itself. This means that any method that's available in the normal container is also available in CacheContainer, the difference is that CacheContainer automatically checks if your entries are expired based on the ttl property. The expired entries are removed from the memory automatically, which means that you don't have to worry about cleaning up disk space.

// adding a new value is the same as in the normal container
container.set('[email protected]', 'value');

// setting a new value with a custom ttl (ignoring the one set during container creation)
container.set('[email protected]', 'value', 5);

Thanks to Zeverotti for his work on this component.