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