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

#2 in #save-path

Download history 97/week @ 2025-09-14 93/week @ 2025-09-21 24/week @ 2025-09-28 13/week @ 2025-10-05 8/week @ 2025-10-12 10/week @ 2025-10-19 2/week @ 2025-10-26

388 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.7–4.5MB
~73K SLoC