fileutils

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: AGPL-3.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPathFromBase64Hash

func GetPathFromBase64Hash(base64Hash types.Base64Hash, absBasePath config.Path) (string, error)

GetPathFromBase64Hash evaluates the path to a media file from its Base64Hash 3 subdirectories are created for more manageable browsing and use the remainder as the file name. For example, if Base64Hash is 'qwerty', the path will be 'q/w/erty/file'.

func MoveFileWithHashCheck

func MoveFileWithHashCheck(tmpDir types.Path, mediaMetadata *types.MediaMetadata, absBasePath config.Path, logger *log.Entry) (types.Path, bool, error)

MoveFileWithHashCheck checks for hash collisions when moving a temporary file to its final path based on metadata The final path is based on the hash of the file. If the final path exists and the file size matches, the file does not need to be moved. In error cases where the file is not a duplicate, the caller may decide to remove the final path. Returns the final path of the file, whether it is a duplicate and an error.

func RemoveDir

func RemoveDir(dir types.Path, logger *log.Entry)

RemoveDir removes a directory and logs a warning in case of errors

func WriteTempFile

func WriteTempFile(
	ctx context.Context, reqReader io.Reader, absBasePath config.Path,
) (hash types.Base64Hash, size types.FileSizeBytes, path types.Path, err error)

WriteTempFile writes to a new temporary file. The file is deleted if there was an error while writing.

Types

This section is empty.

Jump to

Keyboard shortcuts

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