Skip to content

Commit

Permalink
Bump level from 7 to 8 and disable buffer polyfill (#10)
Browse files Browse the repository at this point in the history
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
dependabot[bot] authored Jul 1, 2022
1 parent d16b2b2 commit 2afa2c0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ npm run build

Then open `index.html` in a browser of choice. You're now ready to use your `level` database, backed by IndexedDB!

In order to reduce bundle size, the [`buffer`](https://github.com/feross/buffer) polyfill is excluded. To store binary data, either change browserify configuration, or use Uint8Array instead of Buffer. For example:

```js
import { Level } from 'level'

const db = new Level('browserify-starter', {
keyEncoding: 'view'
})

await db.put(new Uint8Array([1, 2]), 'example')
const example = await db.get(new Uint8Array([1, 2]))
```

## Contributing

[`Level/browserify-starter`](https://github.com/Level/browserify-starter) is an **OPEN Open Source Project**. This means that:
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const level = require('level')
const { Level } = require('level')

async function main () {
const db = level('browserify-starter')
const db = new Level('browserify-starter')
const output = document.getElementById('output')

await db.put('beep', 'boop')
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"private": true,
"license": "MIT",
"scripts": {
"build": "browserify index.js > bundle.js",
"build": "browserify -i buffer index.js > bundle.js",
"test": "npm run build"
},
"dependencies": {
"level": "^7.0.0"
"level": "^8.0.0"
},
"devDependencies": {
"browserify": "^17.0.0"
Expand Down

0 comments on commit 2afa2c0

Please sign in to comment.