atomic
atomic copied to clipboard
atomic is a go package for atomic file writing
In the current os.Rename implementationm MoveFileEx is used but with a different flags: https://cs.opensource.google/go/go/+/refs/tags/go1.18.3:src/internal/syscall/windows/syscall_windows.go;l=293 So the difference is whether `MOVEFILE_WRITE_THROUGH` is used or not. I was wondering why this is...
This commit introduces WrapCopier, which returns a function that implements exactly the functionality of atomic.WriteFile, except with a custom copier. This can be useful when some custom copy behavior (other...
First off, thank you @natefinch and all for putting this tool together! I have the following usecase and wonder if this project can be extended to support it: today, `atomic.WriteFile()`...
In security sensitive use cases, it would be helpful to allow the caller to know if deleting the temp file failed, so it could retry after a delay, or at...
Yet another attempt at using the options pattern as a better version of #18 after the cleanup in #19.
Something about #12 didn't feel right or clean enough, so here's an alternative approach using the options pattern instead. While this increases complexity a bit, it comes with the benefit...
Since this library uses `ioutil.TempFile`, all files are created with 0600 permission (https://golang.org/src/io/ioutil/tempfile.go?s=1419:1477#L65)
Something that came up in a code review with @eau-u4f.
It appears that long file names (longer than `MAX_PATH` which is 260 characters) passed to `atomic.WriteFile` are not automatically prefixed with `\\?\` which makes them fail. I have a workaround...
... so (important) changes (like #5) reach apps using this lib via e.g. @dependabot.