input

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package input gives each handler of an input its own section of it, which it can read independently and concurrently, and seek in, copying an input which can't be read at an offset, such as a pipe, to a temporary file

Index

Constants

This section is empty.

Variables

View Source
var ErrTooLarge = errors.New("input is too large")

ErrTooLarge is returned when the input is larger than its maximum size

Functions

This section is empty.

Types

type Input

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

Input gives content type detection, and each handler, its own section of the input, which it can read independently and concurrently, and seek in. When the input can't be read at an offset and seeked, such as a pipe, it's copied to a temporary file first, which is removed when the input is closed, so it's never read into memory as a whole.

func New

func New(ctx context.Context, r io.Reader, maxSize int64) (*Input, error)

New returns the input of r, from its current position, which is at most maxSize bytes, when maxSize is greater than zero. If r carries a name, it's preserved on each section, since detection uses its extension, and a handler may need the filename itself (e.g. to look up TMDB metadata) rather than the file's contents. The input must be closed.

func (*Input) Close

func (in *Input) Close() error

Close removes the temporary file of the input, if there is one

func (*Input) Reader

func (in *Input) Reader() io.Reader

Reader returns a new section of the input, from its start, with the name of the input, when it has one

Jump to

Keyboard shortcuts

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