hypercore-block-request

0.2.0 • Public • Published

hypercore-block-request

Linearly download the blocks in a sparse Hypercore feed.

Installation

$ npm install hypercore-block-request

Usage

const download = require('hypercore-block-request')
 
// download all blocks until end of feed in strides of 4
// in sets of 2 concurrent download requests starting at block 3
download(feed, { start: 3, concurrency: 2, stride: 4 }, (err) => {
  // download complete
})

API

download(feed, opts, callback)

Linearly download the blocks in a sparse Hypercore feed where opts can be:

{
  // called every time a range of blocks is downloaded
  ondownload(start, end, downloaded, feedLength) {}
  // the max number of concurrency download requests
  concurrency: 4,
  // describes the stride offset in blocks per download requests
  stride: 2,
}
download(feed, opts, (err) => {
  // download complete
})

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.0
    1
  • 0.1.1
    0

Package Sidebar

Install

npm i hypercore-block-request

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

5.24 kB

Total Files

5

Last publish

Collaborators

  • werle