iotools

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

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

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

func NewHashReader

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

func (*HashReader) CalcHashes

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

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

func (*HashReader) Hashes

func (h *HashReader) Hashes() Hashes

func (*HashReader) Read

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

func (*HashReader) ReadAll

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

type HashWriter

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

func NewHashWriter

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

func (*HashWriter) Hashes

func (h *HashWriter) Hashes() Hashes

func (*HashWriter) Write

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

type Hashes

type Hashes map[crypto.Hash]hash.Hash

func NewHashes

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

func (Hashes) AsHttpHeader

func (h Hashes) AsHttpHeader() http.Header

func (Hashes) GetBytes

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

func (Hashes) GetString

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

func (Hashes) Write

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