Package renameio writes files atomically by renaming temporary files.
Pattern returns a glob pattern that matches the unrenamed temporary files created when writing to filename.
ReadFile is like ioutil.ReadFile, but on Windows retries spurious errors that may occur if the file is concurrently replaced.
Errors are classified heuristically and retries are bounded, so even this function may occasionally return a spurious error on Windows. If so, the error will likely wrap one of:
- syscall.ERROR_ACCESS_DENIED - syscall.ERROR_FILE_NOT_FOUND - internal/syscall/windows.ERROR_SHARING_VIOLATION
WriteFile is like ioutil.WriteFile, but first writes data to an arbitrary file in the same directory as filename, then renames it atomically to the final name.
That ensures that the final location, if it exists, is always a complete file.
WriteToFile is a variant of WriteFile that accepts the data as an io.Reader instead of a slice.