files

package
v0.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

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

func AreFilesEqual(file1, file2 string) (bool, error)

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

func CopyFile(src, dst string) error

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

func ToValidFilename(title string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL