pub fn update<P: AsRef<Path>>(path: P, content: &str) -> Result<(), FileError>Expand description
Updates the contents of a file.
If the file doesn’t exist, it will be created.
§Arguments
path- The path of the file to update.content- The new content to write to the file.
§Returns
Returns a Result containing () if successful, or a FileError.
§Examples
use dev_utils::file::{create, update, read};
let file_path = create("example.txt", "Hello").unwrap();
update(&file_path, "Updated content").unwrap();
assert_eq!(read(&file_path).unwrap(), "Updated content");