Latest Socket ResearchMalicious Chrome Extension Performs Hidden Affiliate Hijacking.Details
Socket
Book a DemoInstallSign in
Socket

hyperhealth

Package Overview
Dependencies
Maintainers
5
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperhealth

Monitor the health of a hyperdrive feed, including peer mirror percentages.

Source
npmnpm
Version
1.2.1
Version published
Maintainers
5
Created
Source

hyperhealth

Monitor the health of a hyperdrive or dat, including peer count and peer mirror percentages. Does not actually download any data content, only downloads some of the metadata and monitors the peer feeds.

npm install hyperhealth

Example

var Health = require('hyperhealth')

var health = Health('ARCHIVE_KEY')

// Will fire every 1 second
setInterval(function () {
  var data = health.get()
  console.log(data.peers.length, 'total peers')
  console.log(data.bytes, 'total bytes')
  console.log(data.blocks, 'total blocks')
  console.log('Peer 1 Downloaded ' + (data.peers[0].have / data.peers[0].blocks) * 100 + '%')
}, 1000)

API

health = Health(key-or-archive, [opts])

Takes a hyperdrive key or the corresponding hyperdrive archive instance. Returns an object health.

  • opts are passed to the hyperdiscovery instance

health.swarm

The swarm instance.

health.archive

The archive instance.

health.get()

When called will return an object representing the health at a particular state.

Returns:

  • bytes: Number of total bytes
  • blocks: Number of total blocks
  • peers: An array of the peers containing id, blocks, and have

Peer object

  • id: The unique id of the peer, derived from stream.remoteId
  • have: The number of blocks that have been downloaded
  • blocks: The total number of blocks

Keywords

dat

FAQs

Package last updated on 12 Jan 2017

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