iotools

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCloser deprecated

func AddCloser(reader io.ReadCloser, closer io.Closer, msg ...string) io.ReadCloser

Deprecated: use AddReaderCloser .

func AddReaderCloser

func AddReaderCloser(reader io.Reader, closer io.Closer, msg ...interface{}) io.ReadCloser

func AddWriterCloser

func AddWriterCloser(writer io.Writer, closer io.Closer, msg ...interface{}) io.WriteCloser

func DecodeBase64ToHex added in v0.11.0

func DecodeBase64ToHex(b64encoded string) (string, error)

DecodeBase64ToHex decodes a base64 encoded string and returns the hex representation. Any prefix like 'sha512-' or 'SHA-256:' or 'Sha1-' is removed.

func ListFiles

func ListFiles(path string, fss ...vfs.FileSystem) ([]string, error)

func ReadCloser

func ReadCloser(r io.Reader) io.ReadCloser

func VerifyingReader

func VerifyingReader(r io.ReadCloser, digest digest.Digest) io.ReadCloser

func VerifyingReaderWithHash

func VerifyingReaderWithHash(r io.ReadCloser, hash crypto.Hash, digest string) io.ReadCloser

func WriteCloser

func WriteCloser(w io.Writer) io.WriteCloser

Types

type CountingReader

type CountingReader struct {
	// contains filtered or unexported fields
}

func NewCountingReader

func NewCountingReader(r io.Reader) *CountingReader

func (*CountingReader) Read

func (r *CountingReader) Read(buf []byte) (int, error)

func (*CountingReader) Size

func (r *CountingReader) Size() int64

type CountingWriter

type CountingWriter struct {
	// contains filtered or unexported fields
}

func NewCountingWriter

func NewCountingWriter(w io.Writer) *CountingWriter

func (*CountingWriter) Size

func (w *CountingWriter) Size() int64

func (*CountingWriter) Write

func (w *CountingWriter) Write(buf []byte) (int, error)

type DigestReader

type DigestReader struct {
	// contains filtered or unexported fields
}

func NewDefaultDigestReader

func NewDefaultDigestReader(r io.Reader) *DigestReader

func NewDigestReaderWith

func NewDigestReaderWith(algorithm digest.Algorithm, r io.Reader) *DigestReader

func NewDigestReaderWithHash

func NewDigestReaderWithHash(hash crypto.Hash, r io.Reader) *DigestReader

func (*DigestReader) Digest

func (r *DigestReader) Digest() digest.Digest

func (*DigestReader) Read

func (r *DigestReader) Read(buf []byte) (int, error)

func (*DigestReader) Size

func (r *DigestReader) Size() int64

type DigestWriter

type DigestWriter struct {
	// contains filtered or unexported fields
}

func NewDefaultDigestWriter

func NewDefaultDigestWriter(w io.WriteCloser) *DigestWriter

func NewDigestWriterWith

func NewDigestWriterWith(algorithm digest.Algorithm, w io.WriteCloser) *DigestWriter

func (*DigestWriter) Digest

func (r *DigestWriter) Digest() digest.Digest

func (*DigestWriter) Size

func (r *DigestWriter) Size() int64

func (*DigestWriter) Write

func (r *DigestWriter) Write(buf []byte) (int, error)

type HashReader added in v0.11.0

type HashReader struct {
	// contains filtered or unexported fields
}

func NewHashReader added in v0.11.0

func NewHashReader(delegate io.Reader, algorithms ...crypto.Hash) *HashReader

func (*HashReader) CalcHashes added in v0.11.0

func (h *HashReader) CalcHashes() (int64, error)

CalcHashes returns the total number of bytes read and an error if any besides EOF.

func (*HashReader) Hashes added in v0.11.0

func (h *HashReader) Hashes() Hashes

func (*HashReader) Read added in v0.11.0

func (h *HashReader) Read(buf []byte) (int, error)

func (*HashReader) ReadAll added in v0.11.0

func (h *HashReader) ReadAll() ([]byte, error)

type HashWriter added in v0.11.0

type HashWriter struct {
	// contains filtered or unexported fields
}

func NewHashWriter added in v0.11.0

func NewHashWriter(w io.Writer, algorithms ...crypto.Hash) *HashWriter

func (*HashWriter) Hashes added in v0.11.0

func (h *HashWriter) Hashes() Hashes

func (*HashWriter) Write added in v0.11.0

func (h *HashWriter) Write(buf []byte) (int, error)

type Hashes added in v0.11.0

type Hashes map[crypto.Hash]hash.Hash

func NewHashes added in v0.11.0

func NewHashes(algorithms ...crypto.Hash) Hashes

func (Hashes) AsHttpHeader added in v0.11.0

func (h Hashes) AsHttpHeader() http.Header

func (Hashes) GetBytes added in v0.11.0

func (h Hashes) GetBytes(algorithm crypto.Hash) []byte

func (Hashes) GetString added in v0.11.0

func (h Hashes) GetString(algorithm crypto.Hash) string

func (Hashes) Write added in v0.11.0

func (h Hashes) Write(c int, buf []byte)

type NopCloser

type NopCloser struct{}

func (NopCloser) Close

func (NopCloser) Close() error

type NopWriter

type NopWriter struct {
	NopCloser
}

func (NopWriter) Write

func (n2 NopWriter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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