Documentation ¶
Overview ¶
Package safe provides safe file write semantics by leveraging Rename's() safeity.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
File provides for safe file writes.
func CreateFile ¶
CreateFile creates a new file at filePath for safe writes, it also creates parent directories if they don't exist.
func CreateFileWithPrefix ¶
CreateFileWithPrefix creates a new file at filePath for safe writes, it also creates parent directories if they don't exist. prefix specifies the prefix of the temporary files so that cleaning stale temp files is easy.
func CreateFileWithSuffix ¶
CreateFileWithSuffix is similar to CreateFileWithPrefix, but the second argument is treated as suffix for the temporary files.
func (*File) CloseAndRemove ¶
CloseAndRemove closes the temp file, and safely removes it. Returns error if any.