utio

package
v0.0.0-...-2f614c7 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeFile

func DecodeFile(path string, d Decoder) error

DecodeFile tries to open the file at the specified path and if successful it decodes d.

func DecodeFromString

func DecodeFromString(s string, d Decoder) error

DecodeFromString d the bytes of s to fn.

func EncodeFile

func EncodeFile(path string, e Encoder) error

EncodeFile tries to open the file at the specified path and if successful it encodes e.

func EncodeToString

func EncodeToString(e Encoder) (string, error)

EncodeToString returns the encoded string value

func Files

func Files(root string) ([]string, error)

Files gives back all the files in the specified directory

func FilesFilter

func FilesFilter(dir, glob string) ([]string, error)

Files gives back all the files in the specified directory that match the specified glob pattern.

func Home

func Home() (string, error)

Home gives back the home directory for the current user.

func LoadJPEG

func LoadJPEG(path string) (image.Image, error)

LoadJPEG loads a JPEG image from the supplied path.

func LoadPNG

func LoadPNG(path string) (image.Image, error)

LoadPNG loads a PNG image from the supplied path.

func MustEncodeToString

func MustEncodeToString(e Encoder) string

MustEncodeToString returns the encoded string value and panics if an error has occurred

func PathDoesNotExist

func PathDoesNotExist(path string) bool

PathDoesNotExist tests if the supplied does not exist.

func PathExists

func PathExists(path string) bool

PathExists tests if the supplied path exists.

func ReadFile

func ReadFile(path string, fn ReadFunc) error

ReadFile tries to open the file at the specified path and if successful it invokes fn.

func ReadFromString

func ReadFromString(s string, fn ReadFunc) error

ReadFromString supplies the bytes of s to fn.

func ReadLines

func ReadLines(path string) ([]string, error)

ReadLines reads a text file and splits in lines.

func SaveJPEG

func SaveJPEG(path string, m image.Image) error

SaveJPEG writes an image as JPEG to the supplied path.

func SavePNG

func SavePNG(path string, m image.Image) error

SavePNG writes an image as PNG to the supplied path.

func WriteFile

func WriteFile(path string, fn WriteFunc) error

WriteFile tries to create the file at the specified path and if successful it invokes fn.

func WriteLines

func WriteLines(path string, lines []string) error

WriteLines writes lines to a text file.

func WriteToString

func WriteToString(fn WriteFunc) (string, error)

WriteToString returns the string value of the data written to fn.

Types

type Decoder

type Decoder interface {
	Decode(io.Reader) error
}

Decoder exposes a decoder for a specific value/type.

type Encoder

type Encoder interface {
	Encode(io.Writer) error
}

Encoder exposes an encoder for a specific value/type.

type Imager

type Imager interface {
	Encoder
	Decoder
	Image() image.Image
}

Imager describes a image encoder/decoder.

func JPEG

func JPEG(m image.Image) Imager

JPEG creates a JPEG encoder/decoder for m, m is only required for encoding.

func JPEGOpts

func JPEGOpts(m image.Image, quality int) Imager

type JSONer

type JSONer interface {
	Encoder
	Decoder
}

JSONer describes a JSON encoder/decoder.

func JSON

func JSON(v interface{}) JSONer

JSON creates a JSON encoder/decoder for v.

type Liner

type Liner struct {
	Lines []string
}

func Lines

func Lines() *Liner

Lines creates a coder that encodes/decodes the lines of a text file.

func (*Liner) Decode

func (l *Liner) Decode(r io.Reader) error

func (*Liner) Encode

func (l *Liner) Encode(w io.Writer) error

type PNGer

type PNGer Imager

PNGer describes a PNG encoder/decoder.

func PNG

func PNG(m image.Image) PNGer

PNG creates a PNG encoder/decoder for m, m is only required for encoding.

type ReadFunc

type ReadFunc func(io.Reader) error

ReadFunc defines a read function.

type WriteFunc

type WriteFunc func(io.Writer) error

WriteFunc defines a write function.

Jump to

Keyboard shortcuts

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