osconv

package
v0.0.0-...-48c028d Latest Latest
Warning

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

Go to latest
Published: May 29, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package osconv defines a function which runs through a giving directory and returns a Filesystem in return. Helps in converting filesystem files into a embeddable and usable format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertDataFile

func ConvertDataFile(file string) (filesystem.FileWriter, error)

ConvertDataFile returns a filesystem.FileWriter structure for the giving file path with the data pulled in directly.

func ConvertDir

func ConvertDir(dir string, deferData bool, filterFn func(string) bool) (filesystem.MemoryFileSystem, error)

ConvertDir returns a filesystem.DirWriter structure for the giving directory path and its children. It runs through the directory and skips all paths that passes the filter functions only processing paths that do not. If `deferData` is set to true, it returns structures whoes files do not load their data into memory but wait till their `WriteTo` methods are called to improve memory usage.

func ConvertFile

func ConvertFile(file string) filesystem.FileWriter

ConvertFile returns a filesystem.FileWriter structure for the giving file path with its data pull in later during its WriteTo call.

func WalkDir

func WalkDir(dir string, callback DirWalker) error

WalkDir will run through the provided path which is expected to be a directory and runs the provided callback with the current path and FileInfo.

Types

type DirWalker

type DirWalker func(rel string, abs string, info os.FileInfo) error

DirWalker defines a function type which for processing a path and it's info retrieved from the fs.

type FromFile

type FromFile struct {
	FilePath string
}

FromFile implements io.WriterTo by wrapping a provided file path which will be read into the provided writer.

func (*FromFile) WriteTo

func (fm *FromFile) WriteTo(w io.Writer) (int64, error)

WriteTo implements io.WriterTo.

Jump to

Keyboard shortcuts

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