Skip to main content

write_exclusive_synced

Function write_exclusive_synced 

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

What: Write one file exclusively with mode 0600, refusing links, and sync its bytes, without the explicit mode change. Why: Owner-lock candidates are written this way by the incumbent’s writeCandidate: the creation mode alone, then a sync before publication.

In TS you’d write (pseudocode):

const handle = await open(path, O_CREAT | O_EXCL | O_WRONLY | O_NOFOLLOW, 0o600); await handle.writeFile(bytes); await handle.sync();