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 🙏

© 2024 – Pkg Stats / Ryan Hefner

storkjs

v1.0.4

Published

storkjs - Store your data everywhere

Downloads

16

Readme

StorkJS

Simple key-value storage in your browser.

Easiest way to install is via bower with bower install storkjs.

View Documentation / Download stork.js / Download stork.min.js

  • stork.js is 110KB (17KB gzipped)
  • stork.min.js is 26KB (7KB gzipped)

StorkJS allows you to store key-value pairs & records in the browser, so when your user returns that data is still there. Inspired by lawnchair, StorkJS is a more robust option with error handling, key customization, and much more!

StorkJS uses the most preferred & supported storage available based on your browser.

Features

  • Clean and simple API
  • Pure Javascript, no dependencies
  • Graceful degradation of storage backends, uses the best one available!
  • Keys & Values can be any data type
  • All stored key-value pairs/records can be loaded on initialization or lazy loaded upon request
  • Promises & chaining allow for cleaner code, since saving and retrieving data isn't always synchronous
  • Plugins can be added to alter behavior
  • Everything is cached to avoid unnessary retrievals

API

Functionality added through plugins

Examples

Using StorkJS as a record store

var db = new Stork( {name: 'todos'} );
// Save one record
db.save( {id: 1, title: 'Download Stork JS'} );
// Save multiple at once
db.batch([
  {id: 2, title: 'Use Stork JS'},
  {id: 3, title: '???'},
  {id: 4, title: 'Profit!'}
]);
// Save one without an ID, an ID is placed in the record automatically
db.save( {title: 'Hit the Gym'} );
// Remove one
db.remove( 4 );
// Retrieve a record
db.get( 3, function(todo)
{
  alert( todo.title );
});
// Retrieve all records
db.all(function(todos)
{
  // todos = array of all todo records
});

Using StorkJS as a key-value store

var db = new Stork( {name: 'settings'} );
db.put( 'meow', 'string key' );
db.put( 23, 'number key' );
db.put( true, 'boolean key' );
db.put( {y:5}, 'object key' );
db.put( [1,3], 'array key' );
// Remove one
db.remove( [1,3] );
// Retrieve one key-value pair
db.get( {y:5}, function(value, key)
{
  // value == 'object key'
});
// Retrieve all key-value pairs
db.all(function(values, keys)
{
  // values = array of all values, keys = array of corresponding keys
});

Listening for success or failure

// All saving, removal, & retrieval operations can be passed success & failure callbacks
db.get( 23543,
  function(value, key) {

  },
  function(key, error) {

  })
;

// All saving, removal, & retrieval operations return promises
db.get( 23543 )
  .then(function(value, key) {

  })
  .error(function(error) {

  })
;

// If a result of a callback is a promise, YOU CAN CHAIN THEM!
db.get( 23543 )
  .then(function(value, key) {
    // The value associated to the key
    return this.size();
  })
  .then(function(size) {
    // The current number of key-value pairs.
    return this.all();
  })
  .then(function(values, keys) {
    // All key-value pairs currently stored.
    return this.destroy();
  })
  .then(function() {
    // Everything is destroyed!
  })
  .error(function(error) {
    // Oops!
  })
;

Building

npm install
gulp

Building Documentation

gulp docs

Testing

Once built, view test/index.html in the browser.

TODO

  • [ ] Test chrome-storage-local adapter
  • [ ] Test ie-userdata adapter
  • [ ] Add Blackberry Persistent storage
  • [ ] Add HTML5 Filesystem storage
  • [X] Add IE Userdata storage
  • [X] Add IndexedDB storage
  • [ ] Add CouchDB storage