summaryrefslogtreecommitdiffstats
path: root/src/source
diff options
context:
space:
mode:
Diffstat (limited to 'src/source')
-rw-r--r--src/source/mod.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/source/mod.rs b/src/source/mod.rs
index 20671bc..734b89e 100644
--- a/src/source/mod.rs
+++ b/src/source/mod.rs
@@ -86,24 +86,20 @@ impl SourceEntry {
trace!("Reading to buffer: {}", p.display());
let path = p.clone();
- let buf = tokio::task::spawn_blocking(move || {
- use std::io::Read;
-
- let mut buf = vec![];
+ let reader = tokio::task::spawn_blocking(move || {
std::fs::OpenOptions::new()
.create(false)
.create_new(false)
.read(true)
- .open(path)?
- .read_to_end(&mut buf)
- .map(|_| buf)
+ .open(path)
+ .map(std::io::BufReader::new)
})
.await??;
trace!("Reading to buffer finished: {}", p.display());
self.package_source
.hash()
- .matches_hash_of(&buf)
+ .matches_hash_of(reader)
}
pub async fn create(&self) -> Result<tokio::fs::File> {