Documentation ¶
Index ¶
- Constants
- Variables
- func ChangePathDir(inDir, inPath, outDir string) (string, error)
- func ChangePathDirExt(inDir, inPath, outDir, outExt string) (string, error)
- func ChangePathExt(inPath, outExt string) string
- func Compress(data []byte) ([]byte, error)
- func CompressInPlace(data *[]byte) error
- func CopyFile(src, dest string) error
- func Decompress(data []byte) ([]byte, error)
- func DecompressInPlace(data *[]byte) error
- func Exists(filename string) bool
- func FileHash(filename string) (string, error)
- func FileSize(filename string) (int64, error)
- func IntRange(i0, i1 int) []int
- func IntSetIntersection(a, b map[int]bool) map[int]bool
- func IntSetToSlice(set map[int]bool) []int
- func IntSetUnion(a, b map[int]bool) map[int]bool
- func IntSliceDifference(a, b []int) []int
- func IntSliceIntersection(a, b []int) []int
- func IntSliceSymmetricDifference(a, b []int) []int
- func IntSliceToSet(arr []int) map[int]bool
- func IntSliceUnion(a, b []int) []int
- func MMToPoint(x float64) float64
- func MinMaxIntSlice(arr []int) (min, max int, valid bool)
- func MkDir(dir string) error
- func MkParentDir(filename string) error
- func PointToMM(x float64) float64
- func ReaderSizeHash(rs io.ReadSeeker) (int64, string, error)
- func RegularFile(filename string) (bool, error)
- func RemoveDirectory(dir string) error
- func StringUniques(arr []string) []string
- func WriteJsonSlice(filename string, vals []string) error
Constants ¶
const ( Inch2MM = 25.4 Inch2Point = 72.0 MM2Point = Inch2Point / Inch2MM Point2MM = Inch2MM / Inch2Point )
Variables ¶
var FileHashSize = 10
FileHashSize is the maximum number of hexidecimal digits returned for file hashes.
Functions ¶
func ChangePathDir ¶
ChangePathDir returns `inPath` with its ancestor directory `inDir` replaced with `outDir`.
func ChangePathDirExt ¶
ChangePathDir returns `inPath` with its ancestor directory `inDir` replaced with `outDir` and its extension replaced with `outExt`.
func ChangePathExt ¶
ChangePathExt returns `inPath` with its extension replaced with `outExt`.
func CompressInPlace ¶
CompressInPlace replaces `data` with its flate compressed image on success. On failure `data` is not changed.
func Decompress ¶
Decompress returns the raw data of flate compressed `data`.
func DecompressInPlace ¶
CompressInPlace replaces the flate compressed `data` with its raw data on success. On failure `data` is not changed.
func FileHash ¶
FileHash returns a hex encoded string of the SHA-256 digest of the contents of file `filename`.
func IntSetIntersection ¶
IntSetIntersection returns `a` ∩ `b`.
func IntSetToSlice ¶
IntSetToSlice returns keys of `set` as a slice.
func IntSliceDifference ¶
IntSliceDifference returns the elements in `a` that aren't in `b`.
func IntSliceIntersection ¶
IntSliceIntersection returns `a` ∩ `b`.
func IntSliceSymmetricDifference ¶
IntSliceDifference returns the elements in `a` that aren't in `b` plus the elements in `b` that aren't in `a`.
func IntSliceToSet ¶
IntSliceToSet returns a map whose keys are the elements of `arr`.
func MinMaxIntSlice ¶
MinMaxIntSlice returns min and max of `arr`. `valid` is true if `arr` contains values.
func MkParentDir ¶
MkParentDir creates the parent directory for `filename` if it doesn't already exist.
func ReaderSizeHash ¶
func ReaderSizeHash(rs io.ReadSeeker) (int64, string, error)
ReaderSizeHash return the size in bytes and the hash of the file referenced by `rs`. The hash is hex encoded string of the SHA-256 digest of the contents of `rs`.
func RegularFile ¶
RegularFile returns true if file `filename` is a regular file.
func RemoveDirectory ¶
RemoveDirectory recursively removes directory `dir` and its contents from disk.
func StringUniques ¶
StringUniques returns the unique strings in `arr`.
func WriteJsonSlice ¶
WriteJsonSlice writes slice `vals` to json file `filename`, one line per string. NOTE: We write this json file in a human readable way because we will be using it in development
Types ¶
This section is empty.