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

@sanemethod/idbk

v1.0.0

Published

Simple promise-based key value store, via IndexedDB and idb.js.

Readme

IDBK - A Promise-Based Key-Value Store

IDBK provides a simple wrapper around the promise-based API of idb, intended for handling a simple but regularly-occuring use-case - the use of IndexedDB as a key-value store with a Web Storage API-inspired interface.

Features

  • Familiar Interface: Provides an interface familiar to anyone who's used the Web Storage API.
  • Promise-Based API: Streamlined interaction with asynchronous IndexedDB operations.
  • idb Wrapper: Built on top of idb, meaning you can pull in its more comprehensive suite of promise-based IndexedDB operations if and when needed to supplement your use of IDBK without needing to give up on a Promise-based interface with IndexedDB.

Installation

You can install IDBK via npm:

npm install idbk

Basic Usage

import IDBK from "idbk";

const PRODUCT_DB = "_product_db";
const DB_VERSION = 1;
const INDEXES = {
    path:'path',
    product:'product',
};

/**
 * Instantiate IDBK, passing in the name of the database and the database version, 
 * and pass in schema handler function, which does the necessary in terms of creating or updating the database.
 * See https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB#creating_and_structuring_the_store for more details on creating and structuring IndexedDB stores.
 */
this.db = new IDBK(PRODUCT_DB, DB_VERSION, (db, oldV, newV, tx) => {
    let store;

    try{
        store = db.createObjectStore(PRODUCT_DB, {keyPath:'id'});
    }catch(e){
        store = tx.objectStore(PRODUCT_DB);
    }

    for (const index of Object.keys(INDEXES)){
        try {
            store.deleteIndex(index);
        }catch(e){}

        store.createIndex(index, INDEXES[index]);
    }
});

// Get All Values
const all_records = await this.db.getAll();

// Get a value specified by key
const record = await this.db.get('key');

// Set a value
// @NOTE: 'key' and 'value' are not limited to strings, but can be any value supported by IndexedDB.
//        See: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Basic_Terminology
await this.db.set('key', 'value');

// Remove a value
await this.db.remove('key');

// Remove all values
await this.db.clear();

// Get all keys as an array
const keys = await this.db.keys();

License

The License.txt file contains the details - this project is licensed under the Mozilla Public License, Version 2.0.