Skip to main content

safe_write_in

Function safe_write_in 

pub async fn safe_write_in(
    root: impl AsRef<Path>,
    path: impl AsRef<Path>,
    contents: impl AsRef<[u8]>,
) -> Result<(), Error>
Available on crate feature std only.
Expand description

Write contents to a file below root, creating missing parent directories.

path is treated as relative to root; absolute paths, .. traversal, reserved device names, smuggled prefixes, and symbolic links that resolve outside root are rejected. root itself must exist.