Skip to content

Commit b0b82b6

Browse files
committed
fix: readme and readme location in workspace mode
1 parent e37f7f5 commit b0b82b6

5 files changed

Lines changed: 29 additions & 14 deletions

File tree

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,21 +110,26 @@ In library mode, you can just import the `Downloader` struct and use its
110110
`download()` method to download files.
111111

112112
```rust
113-
use furl_core::Downloader;
113+
use furl_core::{DownloadConfig, Downloader};
114114

115115
// since Downloader::download() method is async, it needs to be implemented
116116
// inside the async function. if it is main function, we can use
117117
// `#[tokio::main]` macro.
118-
119118
#[tokio::main]
120-
async fn main(){
121-
let download_url = "https://raw.githubusercontent.com/ghimiresdp/furl-cli/refs/heads/main/res/images/example.png";
122-
let mut downloader = Downloader::new(download_url);
123-
if let Ok(_) = downloader.download("/home/user/Downloads", Some(4)).await {
124-
println!("Download Complete!")
119+
async fn main() {
120+
let url = "https://raw.githubusercontent.com/ghimiresdp/furl-cli/refs/heads/main/res/images/example.png";
121+
122+
let config = DownloadConfig::default().set_max_chunk_size(5 * 1024 * 1024); // 5 MB
123+
124+
let mut downloader = Downloader::new(url).with_config(config);
125+
126+
if downloader.download(".", None, Some(4)).await.is_ok() {
127+
println!("Download completed successfully!");
128+
} else {
129+
println!("Download failed.");
125130
}
126-
return;
127131
}
132+
128133
```
129134

130135
For runnable workspace examples that embed `furl-cli` as a library,

crates/furl_cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "furl-cli"
33
description = "A fast, multithreaded CLI downloader built in Rust."
44
version = "0.8.0"
55
edition = "2024"
6-
readme = "README.md"
6+
readme = "../../README.md"
77
license = "Apache-2.0"
88
authors = ["Sudip Ghimire"]
99
homepage = "https://github.com/ghimiresdp/furl-cli"

crates/furl_cli/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
pub mod engine;
4040
pub mod features;
4141

42-
pub use engine::{Downloader, ProgressReporter};
42+
pub use engine::{DownloadConfig, Downloader, ProgressReporter};
4343

4444
// re-exporting features for easier access
4545
#[cfg(feature = "progress")]

examples/embedded-minimal/src/main.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
use furl_core::{Downloader, GraphicalProgressReporter};
1+
use furl_core::{DownloadConfig, Downloader, GraphicalProgressReporter};
22

33
#[tokio::main]
44
async fn main() {
55
let url = "https://raw.githubusercontent.com/ghimiresdp/furl-cli/refs/heads/main/res/images/example.png";
6-
let mut downloader = Downloader::new(url).with_reporter(GraphicalProgressReporter::new());
6+
7+
let config = DownloadConfig::default().set_max_chunk_size(5 * 1024 * 1024); // 5 MB
8+
9+
let mut downloader = Downloader::new(url)
10+
.with_reporter(GraphicalProgressReporter::new())
11+
.with_config(config);
12+
713
if downloader.download(".", None, Some(4)).await.is_ok() {
814
println!("Download completed successfully!");
915
} else {

examples/no-indicator/src/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
use furl_core::Downloader;
1+
use furl_core::{DownloadConfig, Downloader};
22

33
#[tokio::main]
44
async fn main() {
55
let url = "https://raw.githubusercontent.com/ghimiresdp/furl-cli/refs/heads/main/res/images/example.png";
6-
let mut downloader = Downloader::new(url);
6+
7+
let config = DownloadConfig::default().set_max_chunk_size(5 * 1024 * 1024); // 5 MB
8+
9+
let mut downloader = Downloader::new(url).with_config(config);
10+
711
if downloader.download(".", None, Some(4)).await.is_ok() {
812
println!("Download completed successfully!");
913
} else {

0 commit comments

Comments
 (0)