Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
node-leveldb
Advanced tools
This package provides a simple, lightweight binding for LevelDB to Node.js. LevelDB is an implementation of a log-structured merge-tree that provides fast key-value storage and lookup.
$ npm install node-leveldb
A LevelDB object is constructed and returned when you require('node-leveldb')
. This object can be used for all operations on a single LevelDB database.
var LevelDB = require('node-leveldb');
Before operating on a LevelDB object, you have to specify which database those operations apply to. If the specified database doesn't already exist, a new one will be created. If your process doesn't have the necessary permissions to create or open the database, this function will throw an exception.
LevelDB.open('path/to/my/database');
Closes the database opened by a previous successful call to LevelDB.open(...)
.
LevelDB.close();
Returns the value associated with key
. If key
doesn't exist in the database, this function returns null
.
console.log(LevelDB.get('myKey'));
Inserts data into the database. If there isn't already a value for key
in the database, this function creates a new entry and maps key
to value
. If key
already exists, it replaces the old value with value
.
LevelDB.set('Ann Leckie', 'Ancillary Justice');
Enumerates data stored in the database. This function takes two optional arguments, the start
and end
of the range of keys to enumerate. If start
is not specified, it is assumed to be from the first item. If end
is not specified, it is assumed to be until the last item. Both start
and end
are inclusive. It's not possible to specify end
without first specifying start
.
LevelDB.list('a', 'z', function(key, value) {
console.log('key: ' + key + ', value: ' + value);
});
Removes data from the database. If key
is found in the database, this function deletes the mapping from key
to its value. This function returns true
if key
was found and a mapping was deleted, false
otherwise.
LevelDB.delete('Ann Leckie');
var LevelDB = require('node-leveldb');
LevelDB.open('authors_database');
LevelDB.set('Frank Herbert', 'Dune');
LevelDB.set('Ursula K. Le Guin', 'The Left Hand of Darkness');
LevelDB.set('Larry Niven', 'Ringworld');
LevelDB.set('Isaac Asimov', 'The Gods Themselves');
// Print the value associated with 'Frank Herbert'.
console.log(LevelDB.get('Frank Herbert'));
LeveLDB.delete('Frank Herbert');
// Print all items stored in the database.
LevelDB.list(function(key, value) {
console.log(key + ': ' + value);
});
// Print all items with 'F' <= key <= 'T'.
LevelDB.list('F', 'T', function(key, value) {
console.log(key + ': ' + value);
});
LevelDB.close();
Apache 2.0
FAQs
Node.js bindings for LevelDB
The npm package node-leveldb receives a total of 5 weekly downloads. As such, node-leveldb popularity was classified as not popular.
We found that node-leveldb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.