An
abstract-leveldowncompliant store on top of IndexedDB, which is in turn implemented on top of LevelDB which brings this whole shebang full circle.
Here are the goals of level-js:
- Store large amounts of data in modern browsers
- Pass the full
abstract-leveldowntest suite - Support Buffer values (in all target environments)
- Support all key types of IndexedDB Second Edition, including binary keys (depends on environment)
- Support all value types of the structured clone algorithm (depends on environment) except for
nullandundefined - Be as fast as possible
- Sync with multilevel over either ASCII or binary transports.
Being abstract-leveldown compliant means you can use many of the Level modules on top of this library. For some demos of it working, see @brycebaril's presentation Path of the NodeBases Jedi.
This assumes use of version 3.0.0-rc1. The next release will have an upgrade guide. Until then, please see the changelog.
var levelup = require('levelup')
var leveljs = require('level-js')
var db = levelup(leveljs('bigdata'))
db.put('hello', Buffer.from('world'), function (err) {
if (err) throw err
db.get('hello', function (err, value) {
if (err) throw err
console.log(value.toString()) // 'world'
})
})npm install level-js # Stable
npm install level-js@next # Bleeding edgeNot to be confused with leveljs.
This library is best used with browserify.
Returns a new leveljs instance. location is the string name of the IDBDatabase to be opened, as well as the object store within that database. The database name will be prefixed with options.prefix.
The optional options argument may contain:
prefix(string, default:'level-js-'): Prefix forIDBDatabasename.version(string | number, default:1): The version to open the database with.
See IDBFactory#open for more details.
git clone git@github.com:Level/level-js.git
cd level-js
npm install
npm testIt will print out a URL to open in a browser of choice.
Cross-browser Testing Platform and Open Source ♥ Provided by Sauce Labs.
MIT © 2012-present Max Ogden and Contributors.