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

b2.db

v10.0.0

Published

Database in png lmao

Downloads

5

Readme

b2DB

B2db is a lightweight TypeScript library that allows you to store and retrieve data within images using steganography. It lets you embed JSON data into images, providing a creative and secure way to store sensitive information or configurations.

Features

  • Simple Interface: Easy-to-use methods to set, get, and manage data within images.
  • TypeScript Support: Written in TypeScript but compatible with both TypeScript and JavaScript projects.
  • Steganography: Uses steganography techniques to hide data within images.
  • Data Concealment: Supports hiding JSON data within images without encryption for quick retrieval.
  • Flexible Use: Suitable for various applications, including storing configurations, sensitive data, or small datasets.

Installation

You can install b2DB via npm:

# Install with npm
npm install b2.db

# Install with yarn
yarn add b2.db

# Install with bun
bun i b2.db

Usage

const { b2DB } = require('b2.db');

const db = new b2DB('./default.png');

const PlayerOne = {
    nickname: 'B2',
    team: 'red',
    areMod: false
};

const PlayerTwo = {
    nickname: '2',
    team: 'red',
    areMod: false
};

db.push('server.players', PlayerOne);
db.push('server.players', PlayerTwo);

console.log(db.get('server.players'));
/*
[
  {
    nickname: "B2",
    team: "red",
    areMod: false,
  }, {
    nickname: "2",
    team: "red",
    areMod: false,
  }
]
*/

db.set('server.info', {
    server_name: "B2's Server",
    slot: 3,
    map: 'dust2'
});

console.log(db.get('server'));
/*
{
  players: [
    {
      nickname: "B2",
      team: "red",
      areMod: false,
    }, {
      nickname: "2",
      team: "red",
      areMod: false,
    }
  ],
  info: {
    server_name: "B2's Server",
    slot: 3,
    map: "dust2",
  },
}
*/

console.log(db.get('server.info'));
/*
{
    server_name: "B2's Server",
    slot: 3,
    map: "dust2",
}
*/

db.add('server.info.slot', 10);
// Server's slot is now at Current + 10 (3+10) : 13

db.sub('server.info.slot', 2);
// Server's slot is now at Current - 2 (13-2) : 11

db.deleteAll();
// Entirely clear the database !!

db.cache('server.info.lock', true, 3000);
// Lock the server access for 3000 ms; (Erase the value after the time's up)

console.log(db.all());
// Return the entire database

console.log(db.has('server.info.lock'));
// Return true if the value exists else return false

db.delete('server');
// Remove the object/value

db.table('anticheat');
// Create another table

Methods

constructor(filePath?: string, options?: any)

Initializes a new instance of the SteganoDB class.

  • filePath: Optional. The path to the image file used for storing data. Defaults to ./steganodb.png.
  • options: Optional. Additional options for the database.

table(tableName: string): SteganoDB

Creates and returns a new SteganoDB instance for a specified table.

  • tableName: The name of the table to create.

get(key: string): any

Retrieves the value associated with the specified key.

  • key: The key whose value should be retrieved. Supports nested keys using dot notation.

has(key: string): boolean

Checks if a value exists for the specified key.

  • key: The key to check for existence. Supports nested keys using dot notation.

set(key: string, value: any): void

Sets the value for the specified key.

  • key: The key to set the value for. Supports nested keys using dot notation. The key cannot be null or contain spaces.
  • value: The value to set.

delete(key: string): void

Deletes the value associated with the specified key.

  • key: The key whose value should be deleted. Supports nested keys using dot notation.

cache(key: string, value: any, time: number): void

Sets a temporary value for the specified key that will be automatically deleted after the specified time.

  • key: The key to set the temporary value for. Supports nested keys using dot notation. The key cannot be null or contain spaces.
  • value: The value to set.
  • time: The time in milliseconds after which the value should be deleted. Must be a number.

add(key: string, count: number): void

Increments the value of the specified key by the specified count. If the key does not exist, it will be initialized to 0 before incrementing.

  • key: The key whose value should be incremented. Supports nested keys using dot notation. The key cannot be null or contain spaces.
  • count: The number to increment the value by. Must be a number.

sub(key: string, count: number): void

Decrements the value of the specified key by the specified count. If the key does not exist, it will be initialized to 0 before decrementing.

  • key: The key whose value should be decremented. Supports nested keys using dot notation. The key cannot be null or contain spaces.
  • count: The number to decrement the value by. Must be a number.

push(key: string, element: any): void

Pushes an element to an array associated with the specified key. If the key does not exist, an array will be created.

  • key: The key whose array should be appended to. Supports nested keys using dot notation. The key cannot be null or contain spaces.
  • element: The element to push into the array.

deleteAll(): void

Clears all data in the database.

all(): Array<{ id: string, value: any }>

Returns an array of all key-value pairs in the database.

pull(key: string, element: any): void

Pull an element of an array associated with the specified key

Creators