7 releases (4 breaking)

Uses new Rust 2024

0.5.1 Sep 20, 2025
0.5.0 Sep 12, 2025
0.4.0 Jun 28, 2025
0.3.0 Dec 2, 2024
0.1.1 Jun 7, 2024

#10 in #transfer-protocol

Download history 131/week @ 2025-06-25 11/week @ 2025-07-02 3/week @ 2025-07-09 141/week @ 2025-09-10 138/week @ 2025-09-17 23/week @ 2025-09-24 29/week @ 2025-10-01 6/week @ 2025-10-08

202 downloads per month
Used in 2 crates

MIT license

38KB
623 lines

This library lets you offer and transfer files to another peer, assuming you already have a reliable connection established.

Example

The peers first establish a direct TCP connection using gday_hole_punch, and encrypt it with gday_encryption.

Peer A and peer B are on different computers in this example.

#
// Peer A offers files and folders they'd like to send
let paths_to_send = ["folder/to/send/".into(), "a/file.txt".into()];
let offer = create_file_offer(&paths_to_send)?;
write_to_async(&offer.offer, &mut stream1).await?;

// Peer B responds to the offer
let offer_msg: FileOfferMsg = read_from_async(&mut stream2).await?;
let requests_msg = FileRequestsMsg::accept_only_new_and_interrupted(
    &offer_msg,
    Path::new("save/the/files/here/"),
)?;
write_to_async(requests_msg, &mut stream2).await?;

// Peer A sends the accepted files
let requests_msg: FileRequestsMsg = read_from_async(&mut stream1).await?;
send_files(&offer, &requests_msg, &mut stream1, |progress| {}).await?;

// Peer B receives the accepted files
let save_path = Path::new("save/the/files/here/");
receive_files(
    &offer_msg,
    &requests_msg,
    save_path,
    &mut stream2,
    |progress| {},
)
.await?;

gday_file_transfer

Crates.io Version docs.rs

This library lets you offer and transfer files to another peer, assuming you already have a connection established.

See the documentation.

Used by

  • gday - Command line tool for sending files.
  • gday_gui - GUI app for sending files.

Dependencies

~2.8–7MB
~123K SLoC