Skip to content

Raynos/level-delete-range

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • Raynos

MIT Licenced