Documentation
¶
Index ¶
- Variables
- func Check(ctx context.Context) error
- func Encode(ctx context.Context, maxBytes int64, encode func(io.Writer) error) ([]byte, error)
- func ReadFile(ctx context.Context, path string) ([]byte, error)
- func WriteFile(ctx context.Context, path string, data []byte, perm fs.FileMode, ...) error
- type Budget
- type File
- type LimitWriter
- type Reader
Constants ¶
This section is empty.
Variables ¶
var ErrOutputLimitExceeded = errors.New("conversion output limit exceeded")
ErrOutputLimitExceeded reports that a conversion attempted to emit more data than its caller-authorized output budget.
Functions ¶
func Check ¶
Check normalizes a nil context and reports cancellation before a conversion starts another unit of work.
func Encode ¶
Encode runs an encoder against a context-aware, size-limited memory buffer. It is useful for serializers that only expose an io.Writer API.
Types ¶
type Budget ¶
Budget shares one output allowance across a conversion's primary file and any sidecars it emits.
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is an output file whose Write method observes a conversion context and enforces a hard byte limit.
func CreateFile ¶
type LimitWriter ¶
LimitWriter checks cancellation and enforces a hard byte limit before each write reaches the wrapped writer.