diff options
author | Kornel <kornel@geekhood.net> | 2020-04-10 14:40:04 +0100 |
---|---|---|
committer | Kornel <kornel@geekhood.net> | 2020-04-10 14:40:30 +0100 |
commit | 2c2e95f854dcac1eaab9e9dcb5aacee94cf92dc8 (patch) | |
tree | a22d08903aacd551cc91a95507db03ec692b331f /datadump/src/main.rs | |
parent | ab582c45f206f62030b9d95dd8bf2150348fb030 (diff) |
Stream datadump
Diffstat (limited to 'datadump/src/main.rs')
-rw-r--r-- | datadump/src/main.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/datadump/src/main.rs b/datadump/src/main.rs index 3ec6c4a..de2cd92 100644 --- a/datadump/src/main.rs +++ b/datadump/src/main.rs @@ -21,7 +21,10 @@ type BoxErr = Box<dyn std::error::Error + Sync + Send>; async fn main() -> Result<(), BoxErr> { tokio::runtime::Handle::current().spawn(async move { let handle = tokio::runtime::Handle::current(); - let mut a = Archive::new(Decoder::new(BufReader::new(File::open("db-dump.tar.gz")?))?); + /// I can't be bothered to make async stream adapter to make async body impl Read + let res = reqwest::blocking::get("https://static.crates.io/db-dump.tar.gz")?; + let res = BufReader::with_capacity(256_000_000, res); + let mut a = Archive::new(Decoder::new(res)?); let ksink = KitchenSink::new_default().await?; tokio::task::block_in_place(move || { |