Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtomicWriteBytes ¶ added in v0.6.4
AtomicWriteBytes writes raw bytes to filePath atomically using temp+rename, fsync'd before rename and the parent directory fsync'd after rename so the new inode entry survives a hard crash. Intended for user-facing files where a crash-window partial write would destroy content — instruction files (AGENTS.md / CONVENTIONS.md), env files, etc.
If filePath is a symlink, the rename follows the symlink to its target so the link itself is preserved and the underlying file is updated. The CLAUDE.md → AGENTS.md pattern that ox init creates depends on this — a naive rename would replace the symlink with a regular file and break the link. Ordinary (non-symlink) paths are written directly as before.
func AtomicWriteJSON ¶
AtomicWriteJSON writes data as JSON to filePath atomically using temp+rename. This prevents partial/corrupt files from concurrent reads during write. The file is fsync'd before rename to ensure durability.
Types ¶
This section is empty.