Demonstrates bundling
level
for browsers usingbrowserify
.
See alsoLevel/webpack-starter
.
git clone https://github.com/Level/browserify-starter.git
cd browserify-starter
npm install
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
polyfill is excluded. To store binary data, either change browserify configuration, or use Uint8Array instead of Buffer. For example:
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]))
Level/browserify-starter
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.
Support us with a monthly donation on Open Collective and help us continue our work.