Expand description
Owner-only files and directories for hosts that write run data to disk.
Run stores, scores, replay cassettes and evaluation reports hold prompts,
model answers and user data. Written with the default umask (often 022)
they are readable by every local user, so hosts create them through these
helpers instead: 0600 files and 0700 directories on Unix. Other
platforms rely on the per-user ACLs of the parent directory.
Modes only apply to what these functions create: an existing file or
directory keeps its permissions, so an operator’s deliberate chmod is
respected. Atomic replaces (write a new temporary file, then rename) always
end up owner-only.
Constants§
- PRIVATE_
DIR_ MODE - Mode of directories created here (Unix).
- PRIVATE_
FILE_ MODE - Mode of files created here (Unix).
Functions§
- append_
file - Open
pathfor appending, creating it owner-only when missing. - create_
dir_ all - Create
pathand its missing parents, each new one owner-only. - create_
file - Open
pathfor writing, truncating it, creating it owner-only when missing. - create_
fresh_ temp_ dir - Create a new, owner-only directory under the system temp directory, named
<prefix>-<pid>-<counter>-<nanos>. - write
- Write
bytestopath(likestd::fs::write), creating it owner-only.