Documentation ¶
Overview ¶
Package file contains helper functions to interact with files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDirExists ¶
CheckDirExists checks that whether the provided directory exists.
Types ¶
type Option ¶
type Option func(o *options)
Option is the type to add optional behavior changes.
func WithBackup ¶
WithBackup specifies the backup pattern for backing up files that already exist. If the filename has an extension, the pattern is inserted between filename base and extension. If the filename does not have an extension, the pattern is added as a suffix.
WithBackup takes precedence over WithForce, meaning, if a file exists, it is backed up and not overwritten.
Example: (pattern: 2021-05-06) - example.txt -> example.2021-05-06.txt - example -> example.2021-05-06