Documentation
¶
Overview ¶
Package files provides utilities for working with files.
Package files offers utilities for working with file operations.
Package files provides utility functions related to file handling.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreFilesEqual ¶
AreFilesEqual checks if the contents of two files are identical.
Parameters:
- file1: The path to the first file.
- file2: The path to the second file.
Returns:
- bool: True if the contents of both files are identical, otherwise false.
- error: An error if any occurred while reading the files, otherwise nil.
func CopyFile ¶
CopyFile copies the contents of the source file to a destination file.
Parameters:
- src: The path to the source file.
- dst: The path to the destination file where the contents of the source file will be copied. If a file with the same name exists, it will be overwritten.
Returns:
- error: An error if any occurred during the file operations, otherwise nil.
func ToValidFilename ¶
ToValidFilename converts a title into a valid filename by replacing invalid characters.
The function checks the title against a predefined set of invalid characters. Any character found in this set will be replaced by a predefined replacement character. The function also ensures that control characters (characters with ASCII values less than 32) are replaced to prevent any unforeseen issues. Finally, it trims any leading or trailing whitespace.
Parameters:
- title: The input string that needs to be converted to a valid filename.
Returns:
- string: A valid filename derived from the title.
Types ¶
This section is empty.