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

level-js

Package Overview
Dependencies
Maintainers
3
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

level-js

An abstract-leveldown compliant store on top of IndexedDB

  • 6.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
521K
decreased by-20.5%
Maintainers
3
Weekly downloads
 
Created

What is level-js?

level-js is a JavaScript implementation of LevelDB for use in the browser. It provides a simple key-value store API that is compatible with the LevelUP interface, making it easy to use in conjunction with other LevelDB-based libraries.

What are level-js's main functionalities?

Basic Key-Value Store

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

const level = require('level-js');
const db = level('my-database');

// 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

Batch operations allow you to perform multiple put and delete operations in a single atomic action, which can be more efficient than performing each operation individually.

const level = require('level-js');
const db = level('my-database');

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

Stream API

The Stream API allows you to create readable and writable streams for iterating over the database entries, which is useful for processing large datasets.

const level = require('level-js');
const db = level('my-database');

// 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 level-js

Keywords

FAQs

Package last updated on 28 Sep 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