You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You data structure has to support a .replicate() stream, then you can replicate
them using the hyperswarm replicator.
constReplicator=require('@hyperswarm/replicator')constr=newReplicator()r.add(aHypercore,{live: true// passed to .replicate})
API
r = new Replicator([options])
Make a new replicator. Options include:
{bootstrap: [...],// optional set the DHT bootstrap servers}
promise = r.add(hyperDataStructure, [options])
Add a hyper* data structure to replicate.
{live: bool,// passed to .replicateupload: bool,// passed to .replicatedownload: bool,// passed to .replicateencrypt: bool,// passed to .replicatediscoveryKey: <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
}
Promise resolves when the data structure has been fully added.
promise = r.remove(hyperDataStructure)
Remove a data structure from replication.
Promise resolves when the data structure has been fully removed.