Home

Awesome

level-delete-range

build status

browser support

Delete a range of keys in leveldb

Example

var level = require("levelidb")
    , after = require("after")
    , toArray = require("write-stream/array")
    , db = level("/tmp/delete-range-simple", {
        createIfMissing: true
    })
    , deleteRange = require("level-delete-range")

var next = after(3, function () {
    deleteRange(db, {
        start: "foo:"
        , end: "foo;"
    }, function (err) {
        db.createReadStream()
            .pipe(toArray(function (list) {
                console.log("list", list)
            }))
    })
})

db.put("foo:1", { foo: "1" }, next)
db.put("foo:2", { foo: "2" }, next)
db.put("foo:3", { foo: "3" }, next)

Installation

npm install level-delete-range

Contributors

MIT Licenced