Use tokio file

This commit is contained in:
QuantumEntangledAndy committed 2023-06-19 10:14:46 +07:00
1 parent b9969ce9ad
commit 0aee461156
1 file changed
+3 -2
+3 -2
View File
@@ -12,6 +12,7 @@
use anyhow::{Context, Result};
use log::*;
use neolink_core::{bc_protocol::*, bcmedia::model::*};
use tokio::{fs::File, io::AsyncWriteExt};
mod cmdline;
mod gst;
@@ -76,9 +77,9 @@ pub(crate) async fn main(opt: Opt, config: Config) -> Result<()> {
// Simply use the snap command
debug!("Using the snap command");
let file_path = opt.file_path.with_extension("jpeg");
let mut buffer = File::create(file_path)?;
let mut buffer = File::create(file_path).await?;
let jpeg_data = camera.get_snapshot().await?;
buffer.write_all(jpeg_data)?;
buffer.write_all(jpeg_data.as_slice()).await?;
}
Ok(())