progress

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB = 1024
	MB = 1024 * KB
	GB = 1024 * MB
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Chunk     []bool `json:"chunk"`
	ChunkSize int64  `json:"chunk_size"`
	FileSize  int64  `json:"-"`
}

func (*Data) CreateProgressFile

func (pd *Data) CreateProgressFile(path string) error

calculate chunk slice and create progress file

func (*Data) IsFinished

func (pd *Data) IsFinished() bool

check if all chunk already finished

func (*Data) LoadProgress

func (pd *Data) LoadProgress(path string) error

load progress from file or create new progress file if not exist

func (*Data) ReadProgressFile

func (pd *Data) ReadProgressFile(path string) error

read compressed progress file and decode to progress data

func (*Data) SaveProgressFile

func (pd *Data) SaveProgressFile(path string) error

save progress data to file with zlib compression

type Report

type Report struct {
	Total   int64 // total file size
	Current int64 // current file size
	// contains filtered or unexported fields
}

func (*Report) ShowReport

func (pr *Report) ShowReport(done chan struct{})

display progress report

func (*Report) Write

func (pr *Report) Write(p []byte) (int, error)

monitor written bytes

Jump to

Keyboard shortcuts

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