You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 2, 2024. It is now read-only.
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 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.
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.
Cross-browser Testing Platform and Open Source ♥ Provided by Sauce Labs.
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.