🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

bep44-storage

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bep44-storage

Bittorrent DHT style content-addressable storage for other databases. Basically a generalized version of BEP44.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

bep44-storage

Bittorrent DHT style content-addressable storage for other databases. Basically BEP 44 for other databases.

Example

var db = require('level')('./db')
var storage = require('bep44-storage')
var store = storage(db)

store.putIm(Buffer('hello there', function(err, key){
  if(err){
    throw err
  }
  console.log(key)
})

API

storage(db)

Creates a store using the database provided. db must contain the functions put, get, del, and createReadStream. See Level DB.

store.putIm(data, cb)

Stores the buffer data as an immutable object. It then calls the function cb with any errors and the key used in store.get.

store.putM(data, keyPair, cb)

Stores the buffer data as a mutable object using the keyPair. It then calls the function cb with any errors and the key used in store.get.

store.get(key, cb)

Gets the data, whether it be mutable or immutable, at the key. It then calls the function cb with any errors and the data.

store.cleanup()

Goes through every key-value pair and removes the ones that aren't valid.

storage.keyPair()

Creates a keyPair for use with store.putM.

storage.valid(key, value)

Returns whether the key-value pair is valid.

Keywords

BEP44

FAQs

Package last updated on 29 Dec 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