mirror of
https://github.com/Waradu/streamshare.git
synced 2025-04-21 11:54:09 +02:00
custom progress callback
This commit is contained in:
parent
11264e4be5
commit
56207bebd7
4 changed files with 22 additions and 46 deletions
15
README.md
15
README.md
|
@ -5,9 +5,17 @@ Upload files to [streamshare](https://streamshare.wireway.ch)
|
|||
#### Example:
|
||||
|
||||
Upload:
|
||||
|
||||
```rust
|
||||
let show_progress = true;
|
||||
match upload(&file_path, show_progress).await {
|
||||
let callback = |uploaded_bytes, total_bytes| {
|
||||
println!(
|
||||
"Uploaded {}b of {}b",
|
||||
uploaded_bytes,
|
||||
total_bytes
|
||||
);
|
||||
}
|
||||
|
||||
match upload(&file_path, callback).await {
|
||||
Ok((file_identifier, _deletion_token)) => {
|
||||
let download_url = format!(
|
||||
"https://streamshare.wireway.ch/download/{}",
|
||||
|
@ -22,9 +30,12 @@ match upload(&file_path, show_progress).await {
|
|||
```
|
||||
|
||||
Delete:
|
||||
|
||||
```rust
|
||||
match streamshare::delete(file_identifier, deletion_token).await {
|
||||
Ok(_) => println!("File deleted successfully"),
|
||||
Err(e) => eprintln!("Error deleting file: {}", e),
|
||||
}
|
||||
```
|
||||
|
||||
Check [toss](https://github.com/Waradu/to-streamshare) for a better example on how to use it.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue