readutil

package
v0.0.0-...-4fdff84 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: BSD-3-Clause Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrReaderDrained = errors.New("io.Reader has been drained")

ErrReaderDrained if reading from a drained PreviewReader

View Source
var ErrUnsupportedType = errors.New("Unsupported decompression type")

Functions

func Decompress

func Decompress(in io.Reader) (io.Reader, error)

Decompress varius types of compression types

func ReadMIME

func ReadMIME(in io.Reader, filename string) (string, error)

ReadMIME of read stream with default size 32 byte

func ReadMIMEWithSize

func ReadMIMEWithSize(in io.Reader, filename string, n int) (string, error)

ReadMIMEWithSize and return best guess for mime

Types

type PreviewReader

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

PreviewReader allows for seeking into a stream that does not support rewind

func NewPreviewReader

func NewPreviewReader(r io.Reader) *PreviewReader

NewPreviewReader wrapps a reader with PreviewReader

func (*PreviewReader) Drain

func (pr *PreviewReader) Drain() io.Reader

Drain returns reader that is reset

func (*PreviewReader) Read

func (pr *PreviewReader) Read(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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