pixelio

package
v0.0.0-...-0728cc5 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDirExists

func EnsureDirExists(dir string) error

EnsureDirExists ensures that given path exists, is a directory, and has the correct permissions

func EnsureOutputDirExists

func EnsureOutputDirExists(parentOutputDir string, subdir string) error

EnsureOutputDirExists ensures that the configured output dir, or subdirectory thereof, exists

func ExtensionMimeType

func ExtensionMimeType(filename string) (mimeType string)

ExtensionMimeType returns the mime time given a file's extension. Uses the stdlib mime package

func ExtensionType

func ExtensionType() map[string]string

ExtensionType inverts TypeExtension to simplify file extension lookups

func GetFileOutputPath

func GetFileOutputPath(parentOutputDir string, f *InputFile, fileExt string) (outputPath string)

GetFileOutputPath returns the path of the output version of a given file, included modifying the file extension

func GetMediaType

func GetMediaType(file *InputFile) (MediaType string)

GetMediaType detects media type from a file's extension. Returns the corresponding key from TypeExtension()

func MoveOriginal

func MoveOriginal(file *InputFile, moveDir string) (err error)

MoveOriginal moves the provided input file to the provided directory, preserving subdirectory structure

func StripFileOutputDir

func StripFileOutputDir(parentOutputDir string, filename string) (baseFilename string)

StripFileOutputDir removes the base output directory from a an output file path, leaving just the subdirectory path and the filename TODO: This doesn't seem like the best way to do things

func TypeExtension

func TypeExtension() map[string][]string

TypeExtension is a map from media types to associated file extensions

Types

type InputFile

type InputFile struct {
	Path     string // Absolute filesystem path to file
	Filename string // Name of file with extension
	Subdir   string // Subdirectory relative to input directory
}

InputFile represents an input file processed by the system

func EnumerateDirContents

func EnumerateDirContents(dir string) (files []*InputFile, err error)

EnumerateDirContents enumerates the contents of a directory, returning an array of inputFiles

func FilterFileType

func FilterFileType(files []*InputFile, fileType string) (filteredFiles []*InputFile)

FilterFileType filters lists of files by type - image, video, etc

func FilterValidFiles

func FilterValidFiles(files []*InputFile) (filteredFiles []*InputFile)

FilterValidFiles returns all valid file types in the input

func InputFileFromFullPath

func InputFileFromFullPath(dir string, fullpath string) (inputFile *InputFile, err error)

InputFileFromFullPath creates an InputFile from the input directory and the full path of a file

Jump to

Keyboard shortcuts

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