From 46d328b6a18a7e60f9c1bd9037d0d86f136726e3 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 9 Apr 2021 19:49:43 -0700 Subject: download: use threads for download-from-file same as stdin --- fatcat-cli/src/download.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fatcat-cli/src/download.rs b/fatcat-cli/src/download.rs index 53c5a41..916f550 100644 --- a/fatcat-cli/src/download.rs +++ b/fatcat-cli/src/download.rs @@ -415,8 +415,12 @@ pub fn download_batch( let buffered = io::BufReader::new(input_file); let lines = buffered.lines(); for line in lines { - let json_str = line?; - download_entity(json_str, output_dir.clone(), show_progress)?; + let task = DownloadTask { + json_str: line?, + output_path: output_dir.clone(), + show_progress, + }; + task_sender.send(task)?; count += 1; if let Some(limit) = limit { if count >= limit { -- cgit v1.2.3