progress

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package progress provides progress reporting functionality

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadCloser

func ReadCloser(contentLength int64, r io.Reader, saveFilename string) io.ReadCloser

Reader returns an io.ReadCloser that copies every byte read into a progress bar.

func Reader

func Reader(contentLength int64, reader io.Reader, saveFilename string) (io.Reader, func())

Types

type BarWriter

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

func (*BarWriter) Write

func (w *BarWriter) Write(p []byte) (int, error)

type ConsoleReporter

type ConsoleReporter struct{}

ConsoleReporter implements Reporter by printing messages to console

func NewConsoleReporter

func NewConsoleReporter() *ConsoleReporter

NewConsoleReporter creates a new ConsoleReporter

func (*ConsoleReporter) End

func (r *ConsoleReporter) End()

func (*ConsoleReporter) Error

func (r *ConsoleReporter) Error(message string)

func (*ConsoleReporter) Start

func (r *ConsoleReporter) Start(message string)

func (*ConsoleReporter) Step

func (r *ConsoleReporter) Step(message string)

func (*ConsoleReporter) Success

func (r *ConsoleReporter) Success(message string)

type NopReporter

type NopReporter struct{}

NopReporter implements Reporter with no-op operations

func NewNopReporter

func NewNopReporter() *NopReporter

NewNopReporter creates a new NopReporter

func (*NopReporter) End

func (r *NopReporter) End()

func (*NopReporter) Error

func (r *NopReporter) Error(message string)

func (*NopReporter) Start

func (r *NopReporter) Start(message string)

func (*NopReporter) Step

func (r *NopReporter) Step(message string)

func (*NopReporter) Success

func (r *NopReporter) Success(message string)

type Reporter

type Reporter interface {
	// Start begins progress reporting with an initial message
	Start(message string)

	// Step reports a new step in the operation
	Step(message string)

	// Error reports an error condition
	Error(message string)

	// Success reports successful completion
	Success(message string)

	// End finalizes progress reporting
	End()
}

Reporter defines the interface for reporting progress. It provides methods to report different stages of an operation and its status.

Jump to

Keyboard shortcuts

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