StagedFile
StagedFile
helps write data to a temporary file, and then gives the option
to commit the temporary file to a desired final file path.
If a file exists at the desired final file path, the file will be overwritten during a commit function call currently.
Only UNIX is currently supported.
Installation
[]
= "0.4"
Example
use StagedFile;
use File;
use ;
use Path;
let final_path = new;
let staged_file = with_final_path?;
let text = b"Hello World!";
staged_file.commit?;
assert_eq!;
If the commit()
method is not called, then the staged file contents are
discarded.
Other Libraries
The library is used as a dependency in this crate to create temporary directories.
A cross platform atomic file writes library.
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.
Contributions
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.