io

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLimitExceeded = errors.New("write limit exceeded")

ErrLimitExceeded is returned when the write limit is exceeded.

Functions

This section is empty.

Types

type LimitedWriter

type LimitedWriter struct {
	W io.Writer // underlying writer
	N int64     // remaining bytes
}

LimitedWriter is a writer that writes to an underlying writer up to a limit.

func LimitWriter

func LimitWriter(w io.Writer, limit int64) *LimitedWriter

LimitWriter returns a new LimitWriter that writes to w.

parameters: w: the writer to write to limit: the maximum number of bytes to write

func (*LimitedWriter) Write

func (l *LimitedWriter) Write(p []byte) (int, error)

Write writes p to the underlying writer up to the limit.

Jump to

Keyboard shortcuts

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