limread

package
v0.0.0-...-8577a5a Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const BufSz = int(256 * datasize.KB)

BufSz is the buffer size for each upload. This is 1MB.

Variables

This section is empty.

Functions

func LimitBody

func LimitBody(size datasize.ByteSize) middleware.F

Types

type ErrFileTooLarge

type ErrFileTooLarge struct {
	Max   int64
	CType string
}

func (ErrFileTooLarge) Error

func (err ErrFileTooLarge) Error() string

func (ErrFileTooLarge) StatusCode

func (err ErrFileTooLarge) StatusCode() int

type LimitedReader

type LimitedReader struct {
	Bytes int64
	CType string // internal only
	// contains filtered or unexported fields
}

func NewLimitedReader

func NewLimitedReader(r LimitedReaderer, max int64) *LimitedReader

func (*LimitedReader) Read

func (r *LimitedReader) Read(b []byte) (int, error)

func (*LimitedReader) WriteTo

func (r *LimitedReader) WriteTo(w io.Writer) (int64, error)

type LimitedReaderer

type LimitedReaderer interface {
	io.Reader
	io.WriterTo
}

type Reader

type Reader struct {
	bufio.Reader
	// contains filtered or unexported fields
}

Reader ensures that Read calls will read the complete stream even after sniffing. Reads wrapped in Reader are inherently buffered.

func NewReader

func NewReader(r io.Reader) (*Reader, error)

func (*Reader) ContentType

func (r *Reader) ContentType() string

Jump to

Keyboard shortcuts

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