{"name":"level-js","version":"2.2.2","description":"leveldown/leveldb library for browsers using IndexedDB","main":"index.js","scripts":{"test":"beefy test/test.js:test.js test/test-levelup.js:test-levelup.js"},"repository":{"type":"git","url":"git+ssh://git@github.com/maxogden/level.js.git"},"keywords":["level","leveldb"],"author":{"name":"max ogden"},"license":"BSD-2-Clause","devDependencies":{"beefy":"~0.3.0","browserify":"^4.1.2","levelup":"~0.18.2","tape":"^4.0.0"},"dependencies":{"abstract-leveldown":"~0.12.0","idb-wrapper":"^1.5.0","isbuffer":"~0.0.0","ltgt":"^1.0.1","typedarray-to-buffer":"~1.0.0","xtend":"~2.1.2"},"testling":{"files":"test/test.js","browsers":["ie/10..latest","firefox/17..latest","chrome/25..latest","opera/15..latest","safari/6.0..latest"]},"gitHead":"99c674487fe5ea8388544724d422934219c2e348","bugs":{"url":"https://github.com/maxogden/level.js/issues"},"homepage":"https://github.com/maxogden/level.js#readme","_id":"level-js@2.2.2","_shasum":"d218018a7ffe2559e370515e19db1ac304d435df","_from":".","_npmVersion":"2.14.2","_nodeVersion":"4.0.0","_npmUser":{"name":"nolanlawson","email":"nolan@nolanlawson.com"},"maintainers":[{"name":"jameskyburz","email":"james.kyburz@gmail.com"},{"name":"juliangruber","email":"julian@juliangruber.com"},{"name":"matteo.collina","email":"hello@matteocollina.com"},{"name":"maxogden","email":"max@maxogden.com"},{"name":"nolanlawson","email":"nolan@nolanlawson.com"}],"dist":{"shasum":"d218018a7ffe2559e370515e19db1ac304d435df","tarball":"http://registry-npm.ywwl.com/level-js/download/level-js-2.2.2.tgz","integrity":"sha512-i6bPjUBU7J7slEFK8LgbTI7mHLa/B5lzMN8u31xYG/R2gCI2WCakhzQhMROCoQ8y8O1NTaXMrOjFx0+839/o5g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD8ngrfp1IPY6UAdzA75qcJLMqTF8nGDZU4/zbziF7zCQIhALRW6G86tLT6WjJIWpsBAFlwxCNCE4qI/A2PsBxRwbwR"}],"size":25610,"noattachment":false,"key":"/level-js/-/level-js-2.2.2.tgz"},"directories":{},"readme":"# level-js\n\n> An [`abstract-leveldown`][abstract-leveldown] compliant store on top of [IndexedDB][indexeddb].\n\n[![level badge][level-badge]][awesome]\n[![npm](https://img.shields.io/npm/v/level-js.svg)](https://www.npmjs.com/package/level-js)\n[![Test](https://img.shields.io/github/workflow/status/Level/level-js/Test?label=test)](https://github.com/Level/level-js/actions/workflows/test.yml)\n[![Coverage](https://img.shields.io/codecov/c/github/Level/level-js?label=&logo=codecov&logoColor=fff)](https://codecov.io/gh/Level/level-js)\n[![Standard](https://img.shields.io/badge/standard-informational?logo=javascript&logoColor=fff)](https://standardjs.com)\n[![Common Changelog](https://common-changelog.org/badge.svg)](https://common-changelog.org)\n[![Donate](https://img.shields.io/badge/donate-orange?logo=open-collective&logoColor=fff)](https://opencollective.com/level)\n\n## Table of Contents\n\n<details><summary>Click to expand</summary>\n\n- [Background](#background)\n- [Example](#example)\n- [Browser Support](#browser-support)\n- [Type Support](#type-support)\n- [Install](#install)\n- [API](#api)\n  - [`db = leveljs(location[, options])`](#db--leveljslocation-options)\n    - [`options`](#options)\n- [Big Thanks](#big-thanks)\n- [Contributing](#contributing)\n- [Donate](#donate)\n- [License](#license)\n\n</details>\n\n## Background\n\nHere are the goals of `level-js`:\n\n- Store large amounts of data in modern browsers\n- Pass the full [`abstract-leveldown`][abstract-leveldown] test suite\n- Support string and [`Buffer`][buffer] keys and values\n- Be as fast as possible\n- ~~Sync with [multilevel](https://github.com/juliangruber/multilevel) over ASCII or binary transports.~~\n\nBeing `abstract-leveldown` compliant means you can use many of the [Level modules][awesome] on top of this library.\n\n## Example\n\n**If you are upgrading:** please see [UPGRADING.md](UPGRADING.md).\n\n```js\nconst levelup = require('levelup')\nconst leveljs = require('level-js')\nconst db = levelup(leveljs('bigdata'))\n\ndb.put('hello', Buffer.from('world'), function (err) {\n  if (err) throw err\n\n  db.get('hello', function (err, value) {\n    if (err) throw err\n\n    console.log(value.toString()) // 'world'\n  })\n})\n```\n\nWith `async/await`:\n\n```js\nconst levelup = require('levelup')\nconst leveljs = require('level-js')\nconst db = levelup(leveljs('bigdata'))\n\nawait db.put('hello', Buffer.from('world'))\nconst value = await db.get('hello')\n```\n\n## Browser Support\n\n[![Sauce Test Status](https://app.saucelabs.com/browser-matrix/level-js.svg)](https://app.saucelabs.com/u/level-js)\n\n## Type Support\n\nKeys and values can be a string or [`Buffer`][buffer]. Any other type will be irreversibly stringified. The only exceptions are `null` and `undefined`. Keys and values of that type are rejected.\n\nIn order to sort string and Buffer keys the same way, for compatibility with `leveldown` and the larger ecosystem, `level-js` internally converts keys and values to binary before passing them to IndexedDB.\n\nIf you desire non-destructive encoding (e.g. to store and retrieve numbers as-is), wrap `level-js` with [`encoding-down`][encoding-down]. Alternatively install [`level`][level] which conveniently bundles [`levelup`][levelup], `level-js` and `encoding-down`. Such an approach is also recommended if you want to achieve universal (isomorphic) behavior. For example, you could have [`leveldown`][leveldown] in a backend and `level-js` in the frontend. The `level` package does exactly that.\n\nWhen getting or iterating keys and values, regardless of the type with which they were stored, keys and values will return as a Buffer unless the `asBuffer`, `keyAsBuffer` or `valueAsBuffer` options are set, in which case strings are returned. Setting these options is not needed when `level-js` is wrapped with `encoding-down`, which determines the optimal return type by the chosen encoding.\n\n```js\ndb.get('key', { asBuffer: false })\ndb.iterator({ keyAsBuffer: false, valueAsBuffer: false })\n```\n\n## Install\n\nWith [npm](https://npmjs.org) do:\n\n```bash\nnpm install level-js\n```\n\nNot to be confused with [leveljs](https://www.npmjs.com/package/leveljs).\n\nThis library is best used with [browserify](http://browserify.org).\n\n## API\n\n### `db = leveljs(location[, options])`\n\nReturns a new `leveljs` instance. `location` is the string name of the [`IDBDatabase`](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase) to be opened, as well as the object store within that database. The database name will be prefixed with `options.prefix`.\n\n#### `options`\n\nThe optional `options` argument may contain:\n\n- `prefix` _(string, default: `'level-js-'`)_: Prefix for `IDBDatabase` name.\n- `version` _(string | number, default: `1`)_: The version to open the database with.\n\nSee [`IDBFactory#open`](https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/open) for more details.\n\n## Big Thanks\n\nCross-browser Testing Platform and Open Source ♥ Provided by [Sauce Labs](https://saucelabs.com).\n\n[![Sauce Labs logo](./sauce-labs.svg)](https://saucelabs.com)\n\n## Contributing\n\n[`Level/level-js`](https://github.com/Level/level-js) is an **OPEN Open Source Project**. This means that:\n\n> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.\n\nSee the [Contribution Guide](https://github.com/Level/community/blob/master/CONTRIBUTING.md) for more details.\n\n## Donate\n\nSupport us with a monthly donation on [Open Collective](https://opencollective.com/level) and help us continue our work.\n\n## License\n\n[MIT](LICENSE)\n\n[level-badge]: https://leveljs.org/img/badge.svg\n\n[indexeddb]: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\n\n[buffer]: https://nodejs.org/api/buffer.html\n\n[awesome]: https://github.com/Level/awesome\n\n[abstract-leveldown]: https://github.com/Level/abstract-leveldown\n\n[levelup]: https://github.com/Level/levelup\n\n[leveldown]: https://github.com/Level/leveldown\n\n[level]: https://github.com/Level/level\n\n[encoding-down]: https://github.com/Level/encoding-down\n","publish_time":1442093842766,"deprecated":"Superseded by browser-level (https://github.com/Level/community#faq)","_cnpm_publish_time":1442093842766,"dist-tags":{"latest":"6.1.0","latest-4":"4.0.2"}}