A library for atomic filesystem operations in Go.
The cattlecloud.net/go/atomicfs/v2 module provides a package for performing
atomic filesystem operations.
The atomicfs package can be added to a project with go get.
go get cattlecloud.net/go/atomicfs/v2@latestimport "cattlecloud.net/go/atomicfs/v2"Written files default to mode 0660 (read-write for the owner and group).
Pass atomicfs.WithMode to override it:
writer := atomicfs.New(
atomicfs.WithTempDir("/tmp"),
atomicfs.WithMode(0600), // custom file mode
)
input := strings.NewReader("hello, world")
_ = writer.WriteFile("/path/to/output.txt", input)The cattlecloud.net/go/atomicfs/v2 module is always improving with new
features and error corrections. For contributing bug fixes and new features
please file an issue.
The cattlecloud.net/go/atomicfs/v2 module is open source under the
BSD-3-Clause license.