This package allows the ease of reading/writing from a leveldb formated database.
This package incorporates the super speeds of Rust by using the pre-existing package rusty-leveldb. The package creates NodeJS bindings to be used in any Node programs.
import { Leveldb } from "@serenityjs/leveldb"
// Open a database with a given path
const db = Leveldb.open("./mydatabase")
// Write a key-value pair to the database
db.put(Buffer.from("Hello"), Buffer.from("World"))
// Read the value for a key from the database
const data = db.get(Buffer.from("Hello"))
const value = data.toString('utf8')
// Delete a key from the database
db.delete(Buffer.from("Hello"))
// Close the database when done!
db.close()