Documentation ¶
Index ¶
- func EnsureDirExists(dir string) error
- func EnsureOutputDirExists(parentOutputDir string, subdir string) error
- func ExtensionMimeType(filename string) (mimeType string)
- func ExtensionType() map[string]string
- func GetFileOutputPath(parentOutputDir string, f *InputFile, fileExt string) (outputPath string)
- func GetMediaType(file *InputFile) (MediaType string)
- func MoveOriginal(file *InputFile, moveDir string) (err error)
- func StripFileOutputDir(parentOutputDir string, filename string) (baseFilename string)
- func TypeExtension() map[string][]string
- type InputFile
- func EnumerateDirContents(dir string) (files []*InputFile, err error)
- func FilterFileType(files []*InputFile, fileType string) (filteredFiles []*InputFile)
- func FilterValidFiles(files []*InputFile) (filteredFiles []*InputFile)
- func InputFileFromFullPath(dir string, fullpath string) (inputFile *InputFile, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureDirExists ¶
EnsureDirExists ensures that given path exists, is a directory, and has the correct permissions
func EnsureOutputDirExists ¶
EnsureOutputDirExists ensures that the configured output dir, or subdirectory thereof, exists
func ExtensionMimeType ¶
ExtensionMimeType returns the mime time given a file's extension. Uses the stdlib mime package
func ExtensionType ¶
ExtensionType inverts TypeExtension to simplify file extension lookups
func GetFileOutputPath ¶
GetFileOutputPath returns the path of the output version of a given file, included modifying the file extension
func GetMediaType ¶
GetMediaType detects media type from a file's extension. Returns the corresponding key from TypeExtension()
func MoveOriginal ¶
MoveOriginal moves the provided input file to the provided directory, preserving subdirectory structure
func StripFileOutputDir ¶
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 ¶
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 ¶
EnumerateDirContents enumerates the contents of a directory, returning an array of inputFiles
func FilterFileType ¶
FilterFileType filters lists of files by type - image, video, etc
func FilterValidFiles ¶
FilterValidFiles returns all valid file types in the input