Documentation ¶
Index ¶
Constants ¶
const ( // DefaultFilePerm are the default file permission to use when the permissions // cannot be determined from the existing file. DefaultFilePerm os.FileMode = 0o644 // DefaultFolderPerm is the default permission to use when creating parent // directories, if they do not already exist. DefaultFolderPerm os.FileMode = 0o755 )
Variables ¶
This section is empty.
Functions ¶
func Write ¶
AtomicWrite accepts a destination path and an reader. It copies the contents to a TempFile on disk, returning if any errors occur.
If the parent destination directory does not exist, it will be created automatically with permissions 0755. To use a different permission, create the directory first or use `chmod`.
If the destination path exists, all attempts will be made to preserve the existing file permissions. If those permissions cannot be read, an error is returned. If the file does not exist, it will be created automatically with permissions 0644. To use a different permission, create the destination file first.
If no errors occur, the Tempfile is "renamed" (moved) to the destination path. On Unix systems, this is guaranteed to be atomic. On Windows, it will be atomic if the files are on the same volume, but cannot be guaranteed if the file crosses volumes. For more information, see:
https://github.com/golang/go/issues/22397#issuecomment-498856679
Types ¶
This section is empty.