-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
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() uses io.Copy() to do the actual I/O to the temporary file. io.Copy is called with os.File and io.Reader, which makes a lot of sense for most cases. I have a particular case where I would like to override the I/O behavior, but still have the file write be atomic.
Can we consider introducing a new function NewWriter() (or WrapWriter()), like so:
func NewWriter(w func(filename string, r io.Reader) error) func(string, io.Reader) error {
return func(...) error {
// Create temp file
// Call w
// Sync and rename resultant file
}Is this within the purview of the project? If so and if people are happy with this proposal, I am happy to submit a PR for this. Thanks!
Metadata
Metadata
Assignees
Labels
No labels