All Projects → alekseykulikov → Storage

alekseykulikov / Storage

Licence: mit
Asynchronous browser storage with multiple back-ends (IndexedDB, WebSQL, localStorage)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Storage

Vlf
A Vue plugin from localForage.vue-localForage or vlf
Stars: ✭ 99 (-83.82%)
Mutual labels:  indexeddb, localstorage
Angular Async Local Storage
Efficient local storage module for Angular apps and PWA: simple API + performance + Observables + validation
Stars: ✭ 539 (-11.93%)
Mutual labels:  indexeddb, localstorage
Redux React Session
🔑 Simple Session API storage for Redux and React
Stars: ✭ 140 (-77.12%)
Mutual labels:  indexeddb, localstorage
Nano Sql
Universal database layer for the client, server & mobile devices. It's like Lego for databases.
Stars: ✭ 717 (+17.16%)
Mutual labels:  indexeddb, localstorage
sync-client
SyncProxy javascript client with support for all major embedded databases (IndexedDB, SQLite, WebSQL, LokiJS...)
Stars: ✭ 30 (-95.1%)
Mutual labels:  localstorage, indexeddb
Godb.js
IndexedDB with Intuitive API,轻松搞定浏览器数据库🎉
Stars: ✭ 78 (-87.25%)
Mutual labels:  indexeddb, localstorage
localForage-cn
localForage中文仓库,localForage改进了离线存储,提供简洁健壮的API,包括 IndexedDB, WebSQL, 和 localStorage。
Stars: ✭ 201 (-67.16%)
Mutual labels:  localstorage, indexeddb
Broadcast Channel
📡 BroadcastChannel to send data between different browser-tabs or nodejs-processes 📡
Stars: ✭ 843 (+37.75%)
Mutual labels:  indexeddb, localstorage
kurimudb
⚓ 足够简单的前端存储解决方案
Stars: ✭ 213 (-65.2%)
Mutual labels:  localstorage, indexeddb
WaWebSessionHandler
(DISCONTINUED) Save WhatsApp Web Sessions as files and open them everywhere!
Stars: ✭ 27 (-95.59%)
Mutual labels:  localstorage, indexeddb
Localforage
💾 Offline storage, improved. Wraps IndexedDB, WebSQL, or localStorage using a simple but powerful API.
Stars: ✭ 19,840 (+3141.83%)
Mutual labels:  indexeddb, localstorage
svelte-persistent-store
A Svelte store that keep its value through pages and reloads
Stars: ✭ 111 (-81.86%)
Mutual labels:  localstorage, indexeddb
Remotestorage.js
⬡ JavaScript client library for integrating remoteStorage in apps
Stars: ✭ 2,155 (+252.12%)
Mutual labels:  indexeddb, localstorage
client-persist
Offline storage for your web client. Supports IndexedDB, WebSQL, localStorage and sessionStorage with an easy to crawl with API.
Stars: ✭ 14 (-97.71%)
Mutual labels:  localstorage, indexeddb
persistence
💾 Persistence provides a pretty easy API to handle Storage's implementations.
Stars: ✭ 18 (-97.06%)
Mutual labels:  localstorage, indexeddb
Immortaldb
🔩 A relentless key-value store for the browser.
Stars: ✭ 2,962 (+383.99%)
Mutual labels:  indexeddb, localstorage
Vue Ls
💥 Vue plugin for work with local storage, session storage and memory storage from Vue context
Stars: ✭ 468 (-23.53%)
Mutual labels:  localstorage
Fakeindexeddb
A pure JS in-memory implementation of the IndexedDB API
Stars: ✭ 373 (-39.05%)
Mutual labels:  indexeddb
Store.js
A simple, lightweight JavaScript API for handling browser localStorage , it is easy to pick up and use, has a reasonable footprint 2.36kb(gzipped: 1.04kb), and has no dependencies.
Stars: ✭ 371 (-39.38%)
Mutual labels:  localstorage
Vuex Persistedstate
💾 Persist and rehydrate your Vuex state between page reloads.
Stars: ✭ 5,561 (+808.66%)
Mutual labels:  localstorage

Storage Build Status

Storage is a functional wrapper around localForage. That means it's an asynchronous browser storage with multiple back-ends (IndexedDB, WebSQL, localStorage), which is built for a better offline experience.

The main differences with localForage:

  • batch get/set support
  • callbacks or promises
  • browserify friendly
  • simple API inspired by yields/store
  • development mode

Installation

$ npm install asyncstorage --save
$ bower install storage
$ component install alekseykulikov/storage

Standalone build available as ./dist/storage.js.

<script src="storage.js"></script>
<script>window.storage('key', fn);</script>

Example

// set
storage({ key: 'val', key2: 'val2'}, function(err) {});

// get
storage('key', function(err, val) {});
storage(['key', 'key2'], function(err, all) {}); // all.length == 2

// count
storage(function(err, count) {}); // count == 2

// delete
storage('key', null, function(err) {});
storage(['key', 'key2'], null, function(err) {});

API

Each method returns promise, and accepts optional callback.

storage([key, val, fn])

Main function is facade to get/set/del/count methods. It's inspired by yields/store. Setting a key to null is equivalent to deleting the key via storage.del(key).

storage.get(key, [fn])

Get key value.

storage.get([key1, key2, ..., keyn], [fn])

Get group of values. Callbacks return array of values for each key. If key does not exist, it returns null on this position.

storage.set(key, val, [fn])

Set key to val. You can store any kind of data, including blobs.

storage.set({ key1: val1, key2: val2, key3: val3 }, [fn])

Run a batch operation. Simple way to create, update, remove multiple records. Use null to remove record.

// assume we have 2 records
storage.set('foo', 7, fn)
storage.set('bar', ['one', 'two', 'three'], fn);

storage.set({
  baz: 'val' // create new val
  foo: 1000, // update `foo` value
  bar: null, // remove `bar`
}, function(err) {});

storage.del(key, [fn])

Delete key.

storage.del([key1, key2, ..., keyn], [fn])

Delete a group of keys in one request.

storage.clear()

Clear storage.

storage.count()

Count records.

storage.development

Work with async code console can be unpleasant. Setup development flag and storage will console.log() results of get or count.

storage.development = true;
storage.set({ foo: 1, bar: 2 });
storage.get(['foo', 'bar']);
// => [1 ,2]
storage.del('bar');
storage.count();
// => 1
// shortcut to: storage.count().then(console.log.bind(console));

storage.forage

It gives you access to the localForage instance. You can use it to configure backend or for advanced methods as keys or iterate.

storage.forage.config({ name: 'my-name' });
if (!window.indexedDB) storage.forage.setDriver(storage.forage.LOCALSTORAGE);

storage.forage.keys().then(function(keys) {
  console.log(keys);
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].