a rust lib to upload and delete files to/from streamshare
Find a file
2024-10-27 13:13:41 +01:00
.github funding 2024-10-27 13:13:41 +01:00
src added replace option and made path handling better 2024-10-20 21:16:05 +02:00
.gitignore init 2024-10-19 22:20:44 +02:00
Cargo.lock added replace option and made path handling better 2024-10-20 21:16:05 +02:00
Cargo.toml added replace option and made path handling better 2024-10-20 21:16:05 +02:00
README.md added replace option and made path handling better 2024-10-20 21:16:05 +02:00

Streamshare (official)

Upload files to streamshare

Example:

Upload:

let client = StreamShare::default();

let callback = |uploaded_bytes, total_bytes| {
    println!(
        "Uploaded {}b of {}b",
        uploaded_bytes,
        total_bytes
    );
}

match client.upload(&file_path, callback).await {
    Ok((file_identifier, _deletion_token)) => {
        let download_url = format!(
            "https://streamshare.wireway.ch/download/{}",
            file_identifier
        );

        println!("File uploaded successfully");
        println!("Download URL: {}", download_url);
    }
    Err(e) => eprintln!("Error: {}", e),
}

Delete:

let client = StreamShare::default();

match client.delete(file_identifier, deletion_token).await {
    Ok(_) => println!("File deleted successfully"),
    Err(e) => eprintln!("Error deleting file: {}", e),
}

Download:

let client = StreamShare::default();

match client.download(file_identifier, path, replace).await {
    Ok(_) => println!("File downloaded successfully"),
    Err(e) => eprintln!("Error downloaded file: {}", e),
}

Check toss for a better example on how to use it.