diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..fd47b11
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,7 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [],
+}
\ No newline at end of file
diff --git a/src/downloader.rs b/src/downloader.rs
index 989e4a4..e3d71eb 100644
--- a/src/downloader.rs
+++ b/src/downloader.rs
@@ -1,6 +1,6 @@
use std::{
error, fmt,
- fs::File,
+ fs::{File, OpenOptions},
io::{self, Read, Write},
};
@@ -30,6 +30,16 @@ impl DualWriter {
Ok(())
}
+
+ pub fn len(&self) -> u64 {
+ match self {
+ DualWriter::File(f) => f.metadata().and_then(|x| Ok(x.len())).unwrap_or_else(|e| {
+ println!("Could not get metadata from file {:?}", e);
+ 0
+ }),
+ DualWriter::Buffer(buf) => buf.len() as u64,
+ }
+ }
}
impl TryFrom