github.com/hashicorp/go-getter/v2@v2.2.2/client_option_progress.go (about)

     1  package getter
     2  
     3  import (
     4  	"io"
     5  )
     6  
     7  // ProgressTracker allows to track the progress of downloads.
     8  type ProgressTracker interface {
     9  	// TrackProgress should be called when
    10  	// a new object is being downloaded.
    11  	// src is the location the file is
    12  	// downloaded from.
    13  	// currentSize is the current size of
    14  	// the file in case it is a partial
    15  	// download.
    16  	// totalSize is the total size in bytes,
    17  	// size can be zero if the file size
    18  	// is not known.
    19  	// stream is the file being downloaded, every
    20  	// written byte will add up to processed size.
    21  	//
    22  	// TrackProgress returns a ReadCloser that wraps the
    23  	// download in progress ( stream ).
    24  	// When the download is finished, body shall be closed.
    25  	TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) (body io.ReadCloser)
    26  }