hugio

package
v0.139.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 40

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir added in v0.56.0

func CopyDir(fs afero.Fs, from, to string, shouldCopy func(filename string) bool) error

CopyDir copies a directory.

func CopyFile added in v0.56.0

func CopyFile(fs afero.Fs, from, to string) error

CopyFile copies a file.

func NewMultiWriteCloser

func NewMultiWriteCloser(writeClosers ...io.WriteCloser) io.WriteCloser

NewMultiWriteCloser creates a new io.WriteCloser that duplicates its writes to all the provided writers.

func NewReadSeekerNoOpCloserFromBytes added in v0.123.0

func NewReadSeekerNoOpCloserFromBytes(content []byte) readSeekerNopCloser

NewReadSeekerNoOpCloserFromBytes uses bytes.NewReader to create a new ReadSeekerNoOpCloser from the given bytes slice.

func ReadString added in v0.123.0

func ReadString(r io.Reader) (string, error)

ReadString reads from the given reader and returns the content as a string.

func ToReadCloser added in v0.54.0

func ToReadCloser(r io.Reader) io.ReadCloser

ToReadCloser creates an io.ReadCloser from the given io.Reader. If it's not already, one will be created with a Close method that does nothing.

func ToWriteCloser added in v0.54.0

func ToWriteCloser(w io.Writer) io.WriteCloser

ToWriteCloser creates an io.WriteCloser from the given io.Writer. If it's not already, one will be created with a Close method that does nothing.

Types

type FlexiWriter added in v0.93.0

type FlexiWriter interface {
	io.Writer
	io.ByteWriter
	WriteString(s string) (int, error)
	WriteRune(r rune) (int, error)
}

As implemented by strings.Builder.

type HasBytesPattern added in v0.128.0

type HasBytesPattern struct {
	Match   bool
	Pattern []byte
}

type HasBytesWriter added in v0.103.0

type HasBytesWriter struct {
	Patterns []*HasBytesPattern
	// contains filtered or unexported fields
}

HasBytesWriter is a writer will match against a slice of patterns.

func (*HasBytesWriter) Write added in v0.103.0

func (h *HasBytesWriter) Write(p []byte) (n int, err error)

type OpenReadSeekCloser added in v0.123.0

type OpenReadSeekCloser func() (ReadSeekCloser, error)

OpenReadSeekCloser allows setting some other way (than reading from a filesystem) to open or create a ReadSeekCloser.

func NewOpenReadSeekCloser added in v0.123.0

func NewOpenReadSeekCloser(r ReadSeekCloser) OpenReadSeekCloser

NewOpenReadSeekCloser creates a new ReadSeekCloser from the given ReadSeeker. The ReadSeeker will be seeked to the beginning before returned.

type PipeReadWriteCloser added in v0.132.0

type PipeReadWriteCloser struct {
	*io.PipeReader
	*io.PipeWriter
}

PipeReadWriteCloser is a convenience type to create a pipe with a ReadCloser and a WriteCloser.

func NewPipeReadWriteCloser added in v0.132.0

func NewPipeReadWriteCloser() PipeReadWriteCloser

NewPipeReadWriteCloser creates a new PipeReadWriteCloser.

func (PipeReadWriteCloser) Close added in v0.132.0

func (c PipeReadWriteCloser) Close() (err error)

func (PipeReadWriteCloser) WriteString added in v0.132.0

func (c PipeReadWriteCloser) WriteString(s string) (int, error)

type ReadSeekCloser

type ReadSeekCloser interface {
	ReadSeeker
	io.Closer
}

ReadSeekCloser is implemented by afero.File. We use this as the common type for content in Resource objects, even for strings.

func NewReadSeekerNoOpCloser

func NewReadSeekerNoOpCloser(r ReadSeeker) ReadSeekCloser

NewReadSeekerNoOpCloser creates a new ReadSeekerNoOpCloser with the given ReadSeeker.

func NewReadSeekerNoOpCloserFromString

func NewReadSeekerNoOpCloserFromString(content string) ReadSeekCloser

NewReadSeekerNoOpCloserFromString uses strings.NewReader to create a new ReadSeekerNoOpCloser from the given string.

type ReadSeekCloserProvider added in v0.90.0

type ReadSeekCloserProvider interface {
	ReadSeekCloser() (ReadSeekCloser, error)
}

ReadSeekCloserProvider provides a ReadSeekCloser.

type ReadSeeker

type ReadSeeker interface {
	io.Reader
	io.Seeker
}

ReadSeeker wraps io.Reader and io.Seeker.

type ReadWriteCloser added in v0.132.0

type ReadWriteCloser interface {
	io.Reader
	io.Writer
	io.Closer
}

type StringReader added in v0.123.0

type StringReader interface {
	ReadString() string
}

StringReader provides a way to read a string.

Jump to

Keyboard shortcuts

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