Registry / utility / creachadair-atomicfile

creachadair-atomicfile

JSON →
library0.4.1gogounverified

Package atomicfile implements all-or-nothing file replacement by staging output to a temporary file and renaming over the target.

go get github.com/creachadair/atomicfile
INSTALL
IMPORT
SIG · CREACHADAIR-ATOMIC
C
creachadair-atomicfile
utilitygov0.4.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

atomicfile
github.com/creachadair/atomicfile

Atomically write to a file

package main import ( "fmt" "github.com/creachadair/atomicfile" ) func main() { w, err := atomicfile.Create("output.txt", 0644) if err != nil { panic(err) } defer w.Close() fmt.Fprintln(w, "Hello, world!") }
Debug
Known issues
gotchaAtomicity depends on the filesystem's rename implementation; not guaranteed on all platforms (e.g., non-POSIX).
fix
Ensure the target filesystem supports atomic rename (POSIX-compliant).
affects: all
Upgrade
Version history
0.4.1latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
creachadair-atomicfile — go get creachadair-atomicfile · libregistry