diff options
Diffstat (limited to 'libs/nak/src/utils.rs')
| -rw-r--r-- | libs/nak/src/utils.rs | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/libs/nak/src/utils.rs b/libs/nak/src/utils.rs deleted file mode 100644 index 7d7886c..0000000 --- a/libs/nak/src/utils.rs +++ /dev/null @@ -1,19 +0,0 @@ -//! Shared utility functions used across the application - -use std::error::Error; -use std::fs; -use std::path::Path; - -/// Download a file from URL to the specified path -pub fn download_file(url: &str, path: &Path) -> Result<(), Box<dyn Error>> { - // Ensure parent directory exists - if let Some(parent) = path.parent() { - fs::create_dir_all(parent)?; - } - - let resp = ureq::get(url).call()?; - let mut reader = resp.into_reader(); - let mut file = fs::File::create(path)?; - std::io::copy(&mut reader, &mut file)?; - Ok(()) -} |
