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.
Copy file name to clipboardExpand all lines: README.md
+6-17Lines changed: 6 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,9 +46,9 @@ Being `abstract-leveldown` compliant means you can use many of the [Level module
46
46
**If you are upgrading:** please see [UPGRADING.md](UPGRADING.md).
47
47
48
48
```js
49
-
var levelup =require('levelup')
50
-
var leveljs =require('level-js')
51
-
var db =levelup(leveljs('bigdata'))
49
+
constlevelup=require('levelup')
50
+
constleveljs=require('level-js')
51
+
constdb=levelup(leveljs('bigdata'))
52
52
53
53
db.put('hello', Buffer.from('world'), function (err) {
54
54
if (err) throw err
@@ -61,7 +61,7 @@ db.put('hello', Buffer.from('world'), function (err) {
61
61
})
62
62
```
63
63
64
-
In ES6 browsers:
64
+
With `async/await`:
65
65
66
66
```js
67
67
constlevelup=require('levelup')
@@ -74,13 +74,13 @@ const value = await db.get('hello')
74
74
75
75
## Browser Support
76
76
77
-
[](https://saucelabs.com/u/level-js)
77
+
[](https://app.saucelabs.com/u/level-js)
78
78
79
79
## Type Support
80
80
81
81
Keys 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.
82
82
83
-
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)`.
83
+
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.
84
84
85
85
If 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.
86
86
@@ -118,17 +118,6 @@ The optional `options` argument may contain:
118
118
119
119
See [`IDBFactory#open`](https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/open) for more details.
120
120
121
-
## Running Tests
122
-
123
-
```sh
124
-
git clone git@github.com:Level/level-js.git
125
-
cd level-js
126
-
npm install
127
-
npm test
128
-
```
129
-
130
-
It will print out a URL to open in a browser of choice.
131
-
132
121
## Big Thanks
133
122
134
123
Cross-browser Testing Platform and Open Source ♥ Provided by [Sauce Labs](https://saucelabs.com).
0 commit comments