# stor

> yolo to storing things in the browser

Latest version **0.1.5** (published 2014-05-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install stor
pnpm add stor
yarn add stor
bun add stor
```

## 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.1.5 |
| Published | 2014-05-25 |
| First published | 2014-03-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Lucas Hrabovsky |
| Maintainers | imlucas |
| Keywords | indexeddb, localstorage, websql |

## Links

- npm: https://www.npmjs.com/package/stor
- Repository: https://github.com/imlucas/node-stor
- Homepage: http://github.com/imlucas/node-stor
- Issues: https://github.com/imlucas/node-stor/issues
- npm.io page: https://npm.io/package/stor

## Dependencies (1)

- [debug](https://npm.io/package/debug.md) https://github.com/Buritica/debug/archive/v0.7.4.tar.gz

## 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.1.5 (latest) — 2014-05-25
- 0.1.4 — 2014-05-25
- 0.1.3 — 2014-05-25
- 0.1.2 — 2014-05-23
- 0.1.1 — 2014-03-12
- 0.1.0 — 2014-03-12

## README

# stor

[![build status](https://secure.travis-ci.org/imlucas/node-stor.png)](http://travis-ci.org/imlucas/node-stor)

Figure out the best option for storing things in the browser and do it.

## Example
```
// @todo: add a not ridiculous example
var stor = require('stor/stor.set('actor', {username: 'yolo17'}, function(err){
  stor.get('actor', function(err, actor){
    console.log(actor);
  });
});
```

## Docs

### stor.get(`key`, `fn`)

### stor.set(`key`, `value`, `fn`)

### stor.remove(`key`, `fn`)

### stor.key(`n`, `fn`)

Backwards compat for `localStorage.key`.  Get the key value in the store at
position `n`.

### stor.length(`fn`)

### stor.clear(`fn`)

### stor.use(`name`)

Manually switch to a different backend

### stor.use(`name`).adapter(`adapter`, `ns`)

Get an adapter for your framework of choice.

## Adapters

### Backbone

```javascript
var Backbone = require('backbone');
var sessionStorage = require('stor').use('session');
var historyBackend = sessionStorage.adapter('backbone', 'history');
var History = Backbone.Collection.extend({
  sync: historyBackend.sync
});
```

## Todo

- [ ] proper api for applying partial updates like Backbone's patch method.
- [ ] id generation
- [ ] namespace support in all stores translated where needed (eg localstorage -> use prefix, indexeddb -> use table name)

## License

MIT

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