ioprogress

package
Version: v0.0.0-...-f559875 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: Apache-2.0 Imports: 2 Imported by: 92

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProgressData

type ProgressData struct {
	// Preferred string repreentation of progress (always set)
	Text string

	// Progress in percent
	Percentage int

	// Number of bytes transferred (for files)
	TransferredBytes int64

	// Total number of bytes (for files)
	TotalBytes int64
}

The ProgressData struct represents new progress information on an operation

type ProgressReader

type ProgressReader struct {
	io.ReadCloser
	Tracker *ProgressTracker
}

ProgressReader is a wrapper around ReadCloser which allows for progress tracking

func (*ProgressReader) Read

func (pt *ProgressReader) Read(p []byte) (int, error)

Read in ProgressReader is the same as io.Read

type ProgressTracker

type ProgressTracker struct {
	Length  int64
	Handler func(int64, int64)
	// contains filtered or unexported fields
}

ProgressTracker provides the stream information needed for tracking

type ProgressWriter

type ProgressWriter struct {
	io.WriteCloser
	Tracker *ProgressTracker
}

ProgressWriter is a wrapper around WriteCloser which allows for progress tracking

func (*ProgressWriter) Write

func (pt *ProgressWriter) Write(p []byte) (int, error)

Write in ProgressWriter is the same as io.Write

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL