Expand description
Peer-to-peer and swarm file transfer over Iroh/QUIC.
Share a file or folder and get a share code; anyone with the code can download it. Files are split into 64 KiB pieces, each verified against a BLAKE3/Bao hash as it arrives, and pulled from every peer in the swarm at once. Downloaders serve what they have to each other (reseeding), and with a data dir, downloads resume after a restart.
// Seeder
let client = chorrent::Client::new().await?;
let seed = client.seed("holiday-photos/").await?;
println!("share this: {}", seed.share_code());
// Downloader (another process or machine)
let client = chorrent::Client::new().await?;
let code: chorrent::ShareCode = "chr2...".parse()?;
let download = client.download(&code, None).await?;
let mut events = download.events(); // progress, peers, ...
let done = download.finished().await?;
if let Some(path) = &done.path {
println!("saved to {}", path.display());
}Re-exports§
Modules§
Structs§
- Client
- A chorrent node: one network identity that can seed and download any number of shares at once.
- Client
Builder - Settings for a
Client. Start fromClient::builder. - Download
Handle - A download in progress. Dropping it cancels the download (pieces already on disk are kept, and resumable with a data dir).
- Download
Options - Extra settings for
Client::download_with. - Endpoint
- Re-exported so embedding apps name the same types (keep your iroh dependency semver-compatible with chorrent’s). Controls an iroh endpoint, establishing connections with other endpoints.
- File
Entry - One file in a share.
- Finished
- A completed, verified download.
- Manifest
- The list of files in a share.
- Network
Status - How this node is connected to the network; see
Client::network_status. - Peer
Check - The result of trying one peer from a share code; see
Client::check_peers. - Seed
Handle - A share being seeded. Seeding stops when this is stopped or dropped.
- Seed
Options - Extra settings for
Client::seed_withandClient::seed_reader. - Share
Code - Everything a downloader needs to find a share’s swarm and verify it.
- ShareId
- Identifies a share: the BLAKE3 hash of its manifest.
Enums§
- Event
- Something that happened during a seed or a download.
- Saved
Transfer - Something from a previous run that can be picked up again with
Client::resume. - Transfer
- Either kind of transfer, as returned by
Client::resume.
Constants§
- ALPN
- The ALPN chorrent’s protocol uses; see
Client::alpnsfor the full list. - PIECE_
SIZE - Size of one piece, in bytes.
Type Aliases§
- Endpoint
Id - Re-exported so embedding apps name the same types (keep your iroh dependency semver-compatible with chorrent’s). The identifier for an endpoint in the (iroh) network.