Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

leveldown

Package Overview
Dependencies
Maintainers
3
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leveldown

A Node.js LevelDB binding, primary backend for LevelUP

  • 1.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
754K
increased by14.2%
Maintainers
3
Weekly downloads
 
Created

What is leveldown?

LevelDOWN is a Node.js binding for LevelDB, a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values. It is used as a backend for the LevelUP module, which provides a more user-friendly API.

What are leveldown's main functionalities?

Open a Database

This feature allows you to open a LevelDB database. The code sample demonstrates how to open a database located at './mydb'.

const leveldown = require('leveldown');
const db = leveldown('./mydb');
db.open(function (err) {
  if (err) throw err;
  console.log('Database opened');
});

Put Data

This feature allows you to store a key-value pair in the database. The code sample shows how to store the value 'value' under the key 'key'.

db.put('key', 'value', function (err) {
  if (err) throw err;
  console.log('Data written');
});

Get Data

This feature allows you to retrieve a value by its key from the database. The code sample demonstrates how to get the value associated with the key 'key'.

db.get('key', function (err, value) {
  if (err) throw err;
  console.log('Data retrieved:', value);
});

Delete Data

This feature allows you to delete a key-value pair from the database. The code sample shows how to delete the key 'key' from the database.

db.del('key', function (err) {
  if (err) throw err;
  console.log('Data deleted');
});

Batch Operations

This feature allows you to perform multiple operations in a single batch. The code sample demonstrates how to perform a batch operation that puts and deletes multiple key-value pairs.

db.batch()
  .put('key1', 'value1')
  .del('key2')
  .put('key3', 'value3')
  .write(function (err) {
    if (err) throw err;
    console.log('Batch operations completed');
  });

Other packages similar to leveldown

Keywords

FAQs

Package last updated on 27 May 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc