progress

package
v1.13.2 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Progress

type Progress struct {

	// Writer .
	Writer io.Writer
	// contains filtered or unexported fields
}

Progress 用來追蹤正在執行之任何 I/O 操作的進度。

func NewProgress

func NewProgress(total uint64) *Progress

NewProgress 針對指定的總大小回傳一個新的進度追蹤器。

func (*Progress) Progress

func (p *Progress) Progress(width int) string

Progress 回傳目前進度的格式化進度字串。

func (*Progress) SetTotal

func (p *Progress) SetTotal(total uint64)

SetTotal 設定封存檔的總大小(位元組)。此函式可安全地並行呼叫, 可用來在總大小變動時進行更新,例如在資料透過進度寫入器寫入的同時, 也在計算總大小的情況。

func (*Progress) Total

func (p *Progress) Total() uint64

Total 回傳總大小(位元組)。

func (*Progress) Write

func (p *Progress) Write(v []byte) (int, error)

Write 統計已寫入至 writer 的位元組總數。

func (*Progress) Written

func (p *Progress) Written() uint64

Written 回傳已寫入的位元組總數。 當進度追蹤的是正在寫入的資料時,應使用此函式。

Jump to

Keyboard shortcuts

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