🚀 Launch Week Day 5:Introducing Immutable Scans.Learn More →
Socket
Book a DemoInstallSign in
Socket

hyperbatch

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

hyperbatch

Addressable batches of data on top of a Hypercore

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

hyperbatch

Addressable batches of data on top of a Hypercore

npm install hyperbatch

Usage

const Hyperbatch = require('hyperbatch')

const b = new Hyperbatch(feed) // pass a hypercore

// append some batches
await b.append([
  Buffer.from('block #0'),
  Buffer.from('block #1')
])

await b.append([
  Buffer.from('block #2'),
  Buffer.from('block #3'),
  Buffer.from('block #4')
])

await b.append([
  Buffer.from('block #5')
])

// how many batches are appended?
await b.length()

// how much data in all batches?
await b.byteLength()

// get a batch
const batch = await b.get(1) // get the second batch

console.log(batch.length) // 3 entries
const block = await batch.get(0) // 'block #2'
const block = await batch.get(1) // 'block #3'

License

MIT

FAQs

Package last updated on 15 Jun 2020

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