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

@gibme/local-storage

v22.0.0

Published

A simple local-storage helper

Readme

@gibme/local-storage

A simple, universal local storage helper that uses the browser's localStorage when available and falls back to file-based storage in the host's temporary directory for Node.js environments.

Storage is generally persistent across pages within a domain in the browser. In Node.js, data persists across application executions via the filesystem.

Requirements

  • Node.js >= 22

Installation

yarn add @gibme/local-storage

or

npm install @gibme/local-storage

A webpack bundle (local-storage.min.js) is also published for direct browser use.

Documentation

https://gibme-npm.github.io/local-storage/

Usage

Basic Operations

import LocalStorage from '@gibme/local-storage';

// Store a value
LocalStorage.set('user', { name: 'Alice', role: 'admin' });

// Check if a key exists
if (LocalStorage.includes('user')) {
    // Retrieve a value (with type inference)
    const user = LocalStorage.get<{ name: string; role: string }>('user');
    console.log(user?.name); // 'Alice'
}

// Remove a specific key
LocalStorage.remove('user');

// Clear all stored data
LocalStorage.clear();

Domain Scoping

Isolate storage between different applications or modules to prevent key collisions. Must be called before any other storage operations.

import LocalStorage from '@gibme/local-storage';

LocalStorage.domain('my-app');

// All subsequent operations are scoped to 'my-app'
LocalStorage.set('config', { debug: true });

Change Listeners

Listen for changes to specific keys:

import LocalStorage, { StorageCallback } from '@gibme/local-storage';

const onConfigChange: StorageCallback<{ debug: boolean }> = (oldValue, newValue, url) => {
    console.log('Config changed:', { oldValue, newValue, url });
};

// Subscribe to changes
LocalStorage.on('config', onConfigChange);

// Listen for a single change
LocalStorage.once('config', (oldValue, newValue) => {
    console.log('Config changed once');
});

// Unsubscribe
LocalStorage.off('config', onConfigChange);

Custom Storage Path (Node.js only)

Override the default temporary directory location:

import LocalStorage from '@gibme/local-storage';

LocalStorage.path = '/var/data/my-app-storage';

Environment Detection

import LocalStorage from '@gibme/local-storage';

if (LocalStorage.isBrowserLocalStorage) {
    console.log('Using browser localStorage');
} else {
    console.log('Using file-based storage at:', LocalStorage.path);
}

API

| Method | Description | |--------|-------------| | get<V>(key) | Retrieve a value by key | | set<V>(key, value) | Store a value | | includes(key) | Check if a key exists | | remove(key) | Remove a key | | clear() | Remove all stored data | | on(key, callback) | Listen for changes to a key | | once(key, callback) | Listen for the next change to a key | | off(key, callback) | Remove a change listener | | domain(scope) | Set the storage scope (Node.js, call before other operations) | | path | Get or set the file storage directory (Node.js only) | | id(key) | Get the underlying SHA-512 hash for a key | | isBrowserLocalStorage | Whether browser localStorage is in use |

License

MIT