package tailfile
import "github.com/docker/docker/pkg/tailfile"
Package tailfile provides helper functions to read the nth lines of any ReadSeeker.
Index ¶
- Variables
- func NewTailReader(ctx context.Context, r SizeReaderAt, reqLines int) (*io.SectionReader, int, error)
- func NewTailReaderWithDelimiter(ctx context.Context, r SizeReaderAt, reqLines int, delimiter []byte) (*io.SectionReader, int, error)
- func TailFile(f *os.File, n int) ([][]byte, error)
- type SizeReaderAt
Variables ¶
var ErrNonPositiveLinesNumber = errors.New("The number of lines to extract from the file must be positive")
ErrNonPositiveLinesNumber is an error returned if the lines number was negative.
Functions ¶
func NewTailReader ¶
func NewTailReader(ctx context.Context, r SizeReaderAt, reqLines int) (*io.SectionReader, int, error)
NewTailReader scopes the passed in reader to just the last N lines passed in
func NewTailReaderWithDelimiter ¶
func NewTailReaderWithDelimiter(ctx context.Context, r SizeReaderAt, reqLines int, delimiter []byte) (*io.SectionReader, int, error)
NewTailReaderWithDelimiter scopes the passed in reader to just the last N lines passed in In this case a "line" is defined by the passed in delimiter.
Delimiter lengths should be generally small, no more than 12 bytes
func TailFile ¶
TailFile returns last n lines of the passed in file.
Types ¶
type SizeReaderAt ¶
SizeReaderAt is an interface used to get a ReaderAt as well as the size of the underlying reader. Note that the size of the underlying reader should not change when using this interface.
Source Files ¶
- Version
- v27.4.0-rc.2+incompatible
- Published
- Nov 19, 2024
- Platform
- js/wasm
- Imports
- 6 packages
- Last checked
- 1 minute ago –
Tools for package owners.