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

xdls

v0.1.9

Published

A cross-domain local storage library.

Downloads

46

Readme

XDLS - Cross-Domain Local Storage

Allows for storing data across domains.

Eg:

var XDLS = require( 'xdls' );

var xdls = new XDLS( {
    origin: 'http://yourdomain.com',
    path: '/xdls.html'
} );

xdls.setItem( 'key', 'value', function( error ) {
    if ( error ) {
        console.error( error );
        return;
    }

    console.log( 'key/value stored into yourdomain.com' );

    xdls.getItem( 'key', function( error, value ) {
        if ( error ) {
            console.error( error );
            return;
        }
        
        console.log( 'got value from yourdomain.com: ' + value );
    } );
} );

METHODS

XDLS is effectively a wrapper around localforage:

getItem

Gets the specified item:

xdls.getItem( 'foo', function( error, value ) {
    if ( error ) {
        console.error( error );
        return;
    }
    
    console.log( 'foo: ' + value );
} );

setItem

Sets the specified item:

xdls.setItem( 'foo', JSON.stringify( { yak: 'baz' } ), function( error ) {
    if ( error ) {
        console.error( error );
    }
} );

removeItem

Removes the specified item:

xdls.removeItem( 'foo', function( error ) {
    if ( error ) {
        console.error( error );
    }
} );

clear

Clears all items:

xdls.clear( function( error ) {
    if ( error ) {
        console.error( error );
    }
} );

length

Gets the number of keys stored:

xdls.length( function( error, len ) {
    if ( error ) {
        console.error( error );
        return;
    }

    console.log( 'Num keys: ' + len );
} );

keys

Gets a list of keys in storage:

xdls.keys( function( error, keys ) {
    if ( error ) {
        console.error( error );
        return;
    }

    console.log( 'keys:\n' + keys.join( '\n' ) );
} );

INSTALLATION

You'll need to place xdls.html somewhere on the domain you'd like to use to share data. Then, in whatever client code you're developing, you'll need to include XDLS via something like browserify.

HOW IT WORKS

When you include XDLS into your client code running on a different domain and initialize it to point at your shared/storage domain, it will create an iframe which loads up xdls.html. That iframe can now store data for that domain using localforage.

When you call the various localforage methods on the local XDLS instance, it will send messages to the iframe, which will proxy them to/from localForage on your shared domain.

WHY YOU MIGHT NEED XDLS

Let's say you make a nice embeddable widget that people can use to show something from your web service on their page. If you want to store any local data, it would be associated with each individual domain that has embedded you.

However, with XDLS you can store that data into your own domain's local storage, which means it can be shared by anyone who's embedded your widget (and with your own site).