Skip to main content

write_private_file

Function write_private_file 

Source
pub fn write_private_file(path: &Path, bytes: &[u8]) -> Result<()>
Expand description

What: Write one private file exclusively, refusing links, then make its bytes durable. &[u8] borrows the exact bytes. Why: A journal state file is created once and never rewritten, so a crash leaves either no file or a complete one after the caller syncs the directory.

In TS you’d write (pseudocode):

async function writePrivateFile({ path, bytes }): Promise<void>;