# localstorage-down

> A Node.js and browserify leveldown API implementation that maps to localstorage in the browser

Latest version **0.6.7** (published 2016-12-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install localstorage-down
pnpm add localstorage-down
yarn add localstorage-down
bun add localstorage-down
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.7 |
| Published | 2016-12-11 |
| First published | 2014-01-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | adamshih, no9, nolanlawson, tenaciousmv |
| Keywords | leveldb, localstorage, leveldown, levelup |

## Links

- npm: https://www.npmjs.com/package/localstorage-down
- Repository: https://github.com/no9/localstorage-down
- Homepage: https://github.com/no9/localstorage-down#readme
- Issues: https://github.com/no9/localstorage-down/issues
- npm.io page: https://npm.io/package/localstorage-down

## Dependencies (7)

- [d64](https://npm.io/package/d64.md) ^1.0.0
- [inherits](https://npm.io/package/inherits.md) ^2.0.1
- [argsarray](https://npm.io/package/argsarray.md) 0.0.1
- [tiny-queue](https://npm.io/package/tiny-queue.md) 0.2.0
- [buffer-from](https://npm.io/package/buffer-from.md) ^0.1.1
- [abstract-leveldown](https://npm.io/package/abstract-leveldown.md) 0.12.3
- [humble-localstorage](https://npm.io/package/humble-localstorage.md) ^1.4.2

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.6.7 (latest) — 2016-12-11
- 0.6.6 — 2016-01-25
- 0.6.5 — 2015-12-20
- 0.6.4 — 2015-12-06
- 0.6.3 — 2014-10-19
- 0.6.2 — 2014-10-15
- 0.6.1 — 2014-08-28
- 0.6.0 — 2014-05-26
- 0.5.2 — 2014-05-20
- 0.5.1 — 2014-05-16
- 0.5.0 — 2014-05-14
- 0.4.4 — 2014-04-29
- 0.4.3 — 2014-04-24
- 0.4.2 — 2014-04-08
- 0.4.1 — 2014-03-27
- … 1 more at https://npm.io/package/localstorage-down/versions

## README

# localstorage-down [![Build Status](https://travis-ci.org/No9/localstorage-down.svg)](https://travis-ci.org/No9/localstorage-down) [![Coverage Status](https://coveralls.io/repos/No9/localstorage-down/badge.svg?branch=master&service=github)](https://coveralls.io/github/No9/localstorage-down?branch=master)

LocalStorage implementation of [leveldown](https://github.com/Level/leveldown) for mobile and desktop browsers. The idea is to be able to use the [level](http://github.com/level) stack on any browser that supports LocalStorage.

The scenarios envisaged are:

1. Occasionally connected clients
2. Ad-hoc networks where clients need to sync directly with each other

This project is intended for use with the [level eco-system](https://github.com/level/).

## Install

```
npm install localstorage-down
```

## Browser support

Basically we support [any browser that has LocalStorage](http://caniuse.com/namevalue-storage), but since we also rely on an ES5 environment due to dependencies from [abstract-leveldown](https://github.com/Level/abstract-leveldown), in practice you will need the following shims in order to work correctly on all browsers (e.g. IE 8-9, Android 2.3):

* [typedarray](https://github.com/substack/typedarray) for binary storage
* [es5-shim](https://github.com/es-shims/es5-shim) for just about everything

We run [automated tests](http://travis-ci.org/No9/localstorage-down) in the following browsers:

* **Firefox**: 40-latest
* **Chrome**: 44-beta
* **IE**: 9-11
* **Edge**: latest
* **Safari**: 7.0-latest
* **iPhone**: 8.0-latest
* **Android**: 4.1-latest

In environments without LocalStorage, such as Node or Safari private browsing, this module
will fall back to a temporary in-memory implementation, thanks to [humble-localstorage](https://www.npmjs.com/package/humble-localstorage).

## Example 

At the command prompt in your chosen directory : 

    npm install localstorage-down
    npm install levelup 
    npm install browserify -g
    npm install beefy -g

Create a file called `index.js` and enter the following:

```js
var localstorage = require('localstorage-down');
var levelup = require('levelup');
var db = levelup('dbname', { db: localstorage });

db.put('name', 'James Dean');
db.put('dob', 'February 8, 1931');
db.put('occupation', 'Rebel');
db.put('cause', 'none');

db.readStream()
   .on('data', function (data) {
      if (typeof data.value !== 'undefined') {
         console.log(data.key, '=', data.value);
      }
   })
   .on('error', function (err) {
      console.log('Oh my!', err);
   })
   .on('close', function () {
      console.log('Stream closed');
   })
   .on('end', function () {
     console.log('Stream ended');
   });
```

Publish the site :

    beefy index.js

See the output :

[http://localhost:9966](http://localhost:9966)

Listen to John Cage:

https://www.youtube.com/watch?v=9hVFCmK6GgM

## Tests

    npm run test

This will run tests in Node against `localstorage-memory`. 

To test in Saucelabs, you can run e.g.:

    npm run test-browser

Or to test in Zuul locally:

    npm run test-zuul-local

To test and check code coverage, run:

    npm run coverage

To test and report code coverage to Coveralls, run:

    npm run report-coverage

##  Contributors

* [Anton Whalley](https://github.com/no9)
* [Adam Shih](https://github.com/adamshih)
* [Nolan Lawson](https://github.com/nolanlawson)
* [Many more!](https://github.com/No9/localstorage-down/graphs/contributors)

---
_Source: https://npm.io/package/localstorage-down · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
