diff --git a/src/adapters/output/local.rs b/src/adapters/output/local.rs index e0ad252..017469b 100644 --- a/src/adapters/output/local.rs +++ b/src/adapters/output/local.rs @@ -9,7 +9,7 @@ pub async fn write_keys_txt_file( file: &mut BufWriter, key: &ApiKey, ) -> Result<()> { - file.write_all(key.as_str().as_bytes()).await?; + file.write_all(format!("{}\n", key.as_str()).as_bytes()).await?; Ok(()) } diff --git a/src/validation.rs b/src/validation.rs index 9fe6ced..8a12473 100644 --- a/src/validation.rs +++ b/src/validation.rs @@ -3,7 +3,7 @@ use async_stream::stream; use futures::{pin_mut, stream::StreamExt}; use reqwest::Client; use std::time::Instant; -use tokio::{fs, sync::mpsc}; +use tokio::{fs, io::AsyncWriteExt, sync::mpsc}; use crate::adapters::write_keys_txt_file; use crate::config::KeyCheckerConfig; @@ -59,6 +59,9 @@ impl ValidationService { } } + // Flush the buffer to ensure all data is written to the file + buffer_writer.flush().await?; + println!("Total Elapsed Time: {:?}", start_time.elapsed()); Ok(()) }