Socket
Book a DemoInstallSign in
Socket

@hyperswarm/replicator

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hyperswarm/replicator

Replicates data structures easily using hyperswarm

Source
npmnpm
Version
1.9.0
Version published
Weekly downloads
18
1700%
Maintainers
3
Weekly downloads
 
Created
Source

@hyperswarm/replicator

Replicate data structures easily using hyperswarm

Install

npm install @hyperswarm/replicator

Usage

You data structure has to support a .replicate() stream, then you can replicate them using the hyperswarm replicator.

const replicate = require('@hyperswarm/replicator')

const swarm = replicate(aHypercore, {
  live: true // passed to .replicate
})

// swarm is a hyperswarm instance that replicates the passed in instance

API

swarm = replicate(dataStructure, [options])

Options include

{
  bootstrap: [...], // optional set the DHT bootstrap servers
  live: bool, // passed to .replicate
  upload: bool, // passed to .replicate
  download: bool, // passed to .replicate
  encrypt: bool, // passed to .replicate
  discoveryKey: <buf>, // optionally set your own discovery key
  announce: true, // should the swarm announce you?
  lookup: true, // should the swarm do lookups for you?
  keyPair: { publicKey, secretKey }, // noise keypair used for the connection
  onauthenticate (remotePublicKey, done) // the onauthenticate hook to verify remote key pairs
}

License

MIT

FAQs

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