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

memdown

Package Overview
Dependencies
Maintainers
3
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memdown

An drop-in replacement for LevelDOWN that works in memory only

  • 6.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
201K
decreased by-37.14%
Maintainers
3
Weekly downloads
 
Created

What is memdown?

memdown is an in-memory backend for the LevelUP library, which provides a simple and efficient way to store and retrieve data in memory. It is particularly useful for testing and development purposes where persistence is not required.

What are memdown's main functionalities?

Basic Operations

This feature allows you to perform basic operations such as putting, getting, and deleting key-value pairs in the in-memory database.

const levelup = require('levelup');
const memdown = require('memdown');

const db = levelup(memdown());

// Put a value
await db.put('key', 'value');

// Get a value
const value = await db.get('key');
console.log(value); // 'value'

// Delete a value
await db.del('key');

Batch Operations

This feature allows you to perform multiple operations in a single batch, which can be more efficient than performing them individually.

const levelup = require('levelup');
const memdown = require('memdown');

const db = levelup(memdown());

// Perform batch operations
await db.batch()
  .put('key1', 'value1')
  .put('key2', 'value2')
  .del('key1')
  .write();

// Get a value
const value = await db.get('key2');
console.log(value); // 'value2'

Stream Operations

This feature allows you to create streams to read data from the database, which can be useful for processing large amounts of data efficiently.

const levelup = require('levelup');
const memdown = require('memdown');

const db = levelup(memdown());

// Put some values
await db.put('key1', 'value1');
await db.put('key2', 'value2');
await db.put('key3', 'value3');

// Create a read stream
const stream = db.createReadStream();

stream.on('data', ({ key, value }) => {
  console.log(`${key}: ${value}`);
});

stream.on('end', () => {
  console.log('Stream ended');
});

Other packages similar to memdown

Keywords

FAQs

Package last updated on 02 Oct 2021

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