buflimit

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package buflimit provides bounded in-memory command output capture.

Index

Constants

This section is empty.

Variables

View Source
var ErrOutputLimit = errors.New("output exceeds limit")

ErrOutputLimit reports that a Buffer retained its byte limit and rejected the remainder of a write.

Functions

This section is empty.

Types

type Buffer

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

Buffer retains at most a fixed number of bytes.

func NewBuffer

func NewBuffer(limit int) *Buffer

NewBuffer returns an empty Buffer with a non-negative byte limit.

func (*Buffer) Bytes

func (b *Buffer) Bytes() []byte

Bytes returns the retained bytes.

func (*Buffer) Err

func (b *Buffer) Err() error

Err returns the output-limit error recorded by Write, if any.

func (*Buffer) Exceeded

func (b *Buffer) Exceeded() bool

Exceeded reports whether a write exceeded the configured limit.

func (*Buffer) String

func (b *Buffer) String() string

func (*Buffer) Write

func (b *Buffer) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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