From 8db2d1e71b8294f2d9c1d7336d994c570b32a438 Mon Sep 17 00:00:00 2001 From: beerpsi Date: Tue, 4 Nov 2025 13:05:10 +0700 Subject: [PATCH] port buffering to exfat extraction --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e90b5d6..80d7cd5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -507,7 +507,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fsdecrypt" -version = "0.1.3" +version = "0.1.4" dependencies = [ "aes", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 1fd949c..3b231d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fsdecrypt" -version = "0.1.3" +version = "0.1.4" edition = "2021" [dependencies] diff --git a/src/main.rs b/src/main.rs index 570528c..c48a12c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -84,8 +84,6 @@ fn extract_exfat_elements(elements: &mut [FsElement], output_dir: &Path) - let dest_path = output_dir.join(file.name()); let mut dest = File::create(dest_path)?; - std::io::copy(file, &mut dest)?; - dest.set_times( FileTimes::new() .set_accessed(exfat_timestamp_to_system_time( @@ -95,6 +93,10 @@ fn extract_exfat_elements(elements: &mut [FsElement], output_dir: &Path) - file.timestamps().modified(), )?), )?; + + let mut writer = BufWriter::with_capacity(256 * 1024, &mut dest); + + std::io::copy(file, &mut writer)?; } FsElement::D(directory) => { let dest_path = output_dir.join(directory.name());