Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 787 Bytes

README.md

File metadata and controls

24 lines (17 loc) · 787 Bytes

Hypercore Replicator

⚠️ WARNING 🚧 API unstable ⚒️ and still in development 👷

This repo defines a Replicator trait for use with Hypercore. It implements the same functionality as this JavaScript Hypercore replication code.

Usage (aspirational):

// import the trait
use replicator::Replicate;

// Get a hypercore
let hypercore = HypercoreBuilder::new(Storage::new_memory().await.unwrap())
    .build()
    .await
    .unwrap();

// Get a AsyncRead + AsyncWrite stream to another hypercore
let listener = TcpListener::bind(&address).await?;

// the `true` indicates this hypercore is the initiator
hypercore.replicate(stream, true))