Write.write_atomic: def of cswap-bend-cli@0.1.0.0 Import: import cswap-bend-cli@0.1.0.0/fs/write.bend as Write Lines 83-88 of cswap-bend-cli@0.1.0.0/fs/write.bend: https://jend.leeeet.dev/read.txt?path=cswap-bend-cli@0.1.0.0/fs/write.bend&start_line=83&end_line=88 import Base import cswap-bend-cli@0.1.0.0/fs.bend as Fs # Write `data` to a sibling temp file, give it `mode` (an octal string such # as "600") while it is still empty, then rename it over `path`. The # secret is never on disk at another mode, and readers see the old file or # the new one, never half of it. def write_atomic(path: String, data: String, mode: String) -> IO(Fs.Res(Unit)): IO.bind(Fs.Res(U32), Fs.Res(Unit), IO.random_u32(), r => publish.tmp(r, path, data, mode)) Uses (8): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.random_u32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/fs/write.bend&name=publish.tmp https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/fs.bend&name=Res