Help us shape the future of Go! Take the 2026 Go Developer Survey

stream

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultChunkSize is the default buffer size for streaming operations.
	DefaultChunkSize = 32 * 1024 // 32KB

	// TailChunkSize is the chunk size for tail operations.
	TailChunkSize = 1024 // 1KB
)

Variables

This section is empty.

Functions

func CopyFileStreaming

func CopyFileStreaming(src, dst string) error

CopyFileStreaming copies a file using streaming with a temporary file for atomicity.

func FormatSize

func FormatSize(size int64) string

FormatSize formats a file size in human-readable format.

func HeadFile

func HeadFile(path string, n int) (string, error)

HeadFile reads the first n lines from a file.

func ReadFileWithLineNumbers

func ReadFileWithLineNumbers(path string, startLine, endLine int) (string, error)

ReadFileWithLineNumbers reads lines from a file in the given range and prefixes each with its 1-based line number. Use 0 for startLine to indicate "from beginning" and 0 for endLine to indicate "to end".

func StreamToBase64

func StreamToBase64(path string) (string, error)

StreamToBase64 encodes a file to base64 using streaming to handle large files.

func TailFile

func TailFile(path string, n int) (string, error)

TailFile reads the last n lines from a file without loading the entire file.

func TailFileWithLineNumbers

func TailFileWithLineNumbers(path string, n int) (string, error)

TailFileWithLineNumbers reads the last n lines from a file with line numbers in a single pass.

Types

This section is empty.

Jump to

Keyboard shortcuts

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