feat: update do_write_file_out

This commit is contained in:
2023-10-17 00:03:07 +08:00
parent 90040bbf8e
commit e0b6df7c46

View File

@@ -128,8 +128,7 @@ pub fn decrypt_single(config: &Option<TinyEncryptConfig>,
}
let mut output: Vec<u8> = Vec::with_capacity(10 * 1024);
let _ = decrypt_file(
&mut file_in, meta.file_length, &mut output,
&key, &nonce, meta.compress,
&mut file_in, meta.file_length, &mut output, &key, &nonce, meta.compress,
)?;
match String::from_utf8(output) {
Err(_) => return simple_error!("File is not UTF-8 content."),
@@ -138,8 +137,7 @@ pub fn decrypt_single(config: &Option<TinyEncryptConfig>,
} else {
let mut file_out = File::create(path_out)?;
let _ = decrypt_file(
&mut file_in, meta.file_length, &mut file_out,
&key, &nonce, meta.compress,
&mut file_in, meta.file_length, &mut file_out, &key, &nonce, meta.compress,
)?;
drop(file_out);
}