All Projects → Level → Level Js

Level / Level Js

Licence: other
An abstract-leveldown compliant store on top of IndexedDB.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Level Js

Memdown
In-memory abstract-leveldown store for Node.js and browsers.
Stars: ✭ 259 (-46.6%)
Mutual labels:  level, browser
Level Browserify
No longer maintained: superseded by level v5.0.0.
Stars: ✭ 64 (-86.8%)
Mutual labels:  level, browser
Filer
Node-like file system for browsers
Stars: ✭ 389 (-19.79%)
Mutual labels:  indexeddb, browser
Simple Fs
Handles files on indexeddb like you would do in node.js (promise)
Stars: ✭ 111 (-77.11%)
Mutual labels:  indexeddb, browser
Levelup
A wrapper for abstract-leveldown compliant stores, for Node.js and browsers.
Stars: ✭ 3,960 (+716.49%)
Mutual labels:  level, browser
Ky Universal
Use Ky in both Node.js and browsers
Stars: ✭ 421 (-13.2%)
Mutual labels:  browser
Slate
A completely customizable framework for building rich text editors. (Currently in beta.)
Stars: ✭ 23,104 (+4663.71%)
Mutual labels:  browser
Stormdb
🌩️ StormDB is a tiny, lightweight, 0 dependency, easy-to-use JSON-based database for NodeJS, the browser or Electron.
Stars: ✭ 406 (-16.29%)
Mutual labels:  browser
Amfora
A fancy terminal browser for the Gemini protocol.
Stars: ✭ 395 (-18.56%)
Mutual labels:  browser
Browser
🌍 Take back your privacy with Dot Browser, the privacy-conscious web browser that protects you from being tracked and monitored online.
Stars: ✭ 475 (-2.06%)
Mutual labels:  browser
Detect Gpu
Classifies GPUs based on their 3D rendering benchmark score allowing the developer to provide sensible default settings for graphically intensive applications.
Stars: ✭ 460 (-5.15%)
Mutual labels:  browser
Clipboard Copy
Lightweight copy to clipboard for the web
Stars: ✭ 443 (-8.66%)
Mutual labels:  browser
Chrome Har Capturer
Capture HAR files from a Chrome instance
Stars: ✭ 423 (-12.78%)
Mutual labels:  browser
Mocha
☕️ simple, flexible, fun javascript test framework for node.js & the browser
Stars: ✭ 20,986 (+4227.01%)
Mutual labels:  browser
Gcping
Measure your latency to GCP regions
Stars: ✭ 405 (-16.49%)
Mutual labels:  browser
Tfjs Yolo Tiny
In-Browser Object Detection using Tiny YOLO on Tensorflow.js
Stars: ✭ 465 (-4.12%)
Mutual labels:  browser
Theannoyingsite.com
The Annoying Site a.k.a. "The Power of the Web Platform"
Stars: ✭ 446 (-8.04%)
Mutual labels:  browser
Drag Drop
HTML5 drag & drop for humans
Stars: ✭ 443 (-8.66%)
Mutual labels:  browser
Naglfar
A toy web browser implemented in Rust from scratch
Stars: ✭ 456 (-5.98%)
Mutual labels:  browser
Scriptsafe
a browser extension to bring security and privacy to chrome, firefox, and opera
Stars: ✭ 434 (-10.52%)
Mutual labels:  browser

level-js

An abstract-leveldown compliant store on top of IndexedDB.

level badge npm Travis npm Coverage Status JavaScript Style Guide Backers on Open Collective Sponsors on Open Collective

Table of Contents

Click to expand

Background

Here are the goals of level-js:

  • Store large amounts of data in modern browsers
  • Pass the full abstract-leveldown test suite
  • Support string and Buffer keys and values
  • Be as fast as possible
  • Sync with multilevel over ASCII or binary transports.

Being abstract-leveldown compliant means you can use many of the Level modules on top of this library.

Example

If you are upgrading: please see UPGRADING.md.

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'
  })
})

In ES6 browsers:

const levelup = require('levelup')
const leveljs = require('level-js')
const db = levelup(leveljs('bigdata'))

await db.put('hello', Buffer.from('world'))
const value = await db.get('hello')

Browser Support

Sauce Test Status

Type Support

Keys and values can be a string or Buffer. Any other type will be irreversibly stringified. The only exceptions are null and undefined. Keys and values of that type are rejected.

In 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. If binary keys are not supported by the environment (like IE11) level-js falls back to String(key).

If you desire non-destructive encoding (e.g. to store and retrieve numbers as-is), wrap level-js with encoding-down. Alternatively install level which conveniently bundles 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 in a backend and level-js in the frontend. The level package does exactly that.

When 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.

db.get('key', { asBuffer: false })
db.iterator({ keyAsBuffer: false, valueAsBuffer: false })

Install

With npm do:

npm install level-js

Not to be confused with leveljs.

This library is best used with browserify.

API

db = leveljs(location[, options])

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.

options

The optional options argument may contain:

  • prefix (string, default: 'level-js-'): Prefix for IDBDatabase name.
  • version (string | number, default: 1): The version to open the database with.

See IDBFactory#open for more details.

Running Tests

git clone [email protected]:Level/level-js.git
cd level-js
npm install
npm test

It will print out a URL to open in a browser of choice.

Big Thanks

Cross-browser Testing Platform and Open Source ♥ Provided by Sauce Labs.

Sauce Labs logo

Contributing

Level/level-js is an OPEN Open Source Project. This means that:

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.

See the Contribution Guide for more details.

Donate

To sustain Level and its activities, become a backer or sponsor on Open Collective. Your logo or avatar will be displayed on our 28+ GitHub repositories and npm packages. 💖

Backers

Open Collective backers

Sponsors

Open Collective sponsors

License

MIT © 2012-present Max Ogden and Contributors.

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].