Registry / utility / facebookgo-atomicfile

facebookgo-atomicfile

JSON →
library0.0.0-20151019160806-2de1f203e7d5gogounverified

Package atomicfile provides the ability to write a file with an eventual rename on Close (using os.Rename), allowing for a file to always be in a consistent state and never represent an in-progress write.

go get github.com/facebookgo/atomicfile
INSTALL
IMPORT
SIG · FACEBOOKGO-ATOMICF
F
facebookgo-atomicfile
utilitygov0.0.0-20151019160806-2de1f203e7d5
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/facebookgo/atomicfile

Creates an atomic file and writes data to it.

package main import ( "log" "github.com/facebookgo/atomicfile" ) func main() { f, err := atomicfile.New("example.txt", 0644) if err != nil { log.Fatal(err) } defer f.Close() f.Write([]byte("Hello, world!")) }
Debug
Known issues
gotchaos.Rename may not be atomic on all operating systems
fix
Ensure the target filesystem supports atomic renames (e.g., local POSIX filesystems).
affects: all
Upgrade
Version history
0.0.0-20151019160806-2de1f203e7d5latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
facebookgo-atomicfile — go get facebookgo-atomicfile · libregistry