Versions in this module Expand all Collapse all v1 v1.0.1 Apr 27, 2026 Changes in this version + var Decompressors = LimitedDecompressors(noFilesLimit, noFileSizeLimit) + var Detectors []Detector + var ErrSymlinkCopy = errors.New("copying of symlinks has been disabled") + var Getters map[string]Getter + func Copy(ctx context.Context, dst io.Writer, src io.Reader) (int64, error) + func Detect(src string, pwd string, ds []Detector) (string, error) + func Get(ctx context.Context, dst, src string, opts ...ClientOption) error + func GetAny(ctx context.Context, dst, src string, opts ...ClientOption) error + func GetFile(ctx context.Context, dst, src string, opts ...ClientOption) error + func LimitedDecompressors(filesLimit int, fileSizeLimit int64) map[string]Decompressor + func RedactURL(u *url.URL) string + func SourceDirSubdir(src string) (string, string) + func SubdirGlob(dst, subDir string) (string, error) + func TestDecompressor(t testing.TB, d Decompressor, cases []TestDecompressCase) + func WithInsecure() func(*Client) error + func WithProgress(pl ProgressTracker) func(*Client) error + type BitBucketDetector struct + func (d *BitBucketDetector) Detect(src, _ string) (string, bool, error) + type Bzip2Decompressor struct + FileSizeLimit int64 + func (d *Bzip2Decompressor) Decompress(dst, src string, dir bool, umask os.FileMode) error + type ChecksumError struct + Actual []byte + Expected []byte + File string + Hash hash.Hash + func (cerr *ChecksumError) Error() string + type Client struct + Decompressors map[string]Decompressor + Detectors []Detector + Dir bool + DisableSymlinks bool + Dst string + Getters map[string]Getter + Insecure bool + Mode ClientMode + Options []ClientOption + ProgressListener ProgressTracker + Pwd string + Src string + Umask os.FileMode + func (c *Client) ChecksumFromFile(ctx context.Context, checksumFile string, src *url.URL) (*FileChecksum, error) + func (c *Client) Configure(opts ...ClientOption) error + func (c *Client) Get(ctx context.Context) error + type ClientMode uint + const ClientModeAny + const ClientModeDir + const ClientModeFile + const ClientModeInvalid + type ClientOption func(*Client) error + func WithDecompressors(decompressors map[string]Decompressor) ClientOption + func WithDetectors(detectors []Detector) ClientOption + func WithGetters(getters map[string]Getter) ClientOption + func WithMode(mode ClientMode) ClientOption + func WithUmask(mode os.FileMode) ClientOption + type Decompressor interface + Decompress func(dst, src string, dir bool, umask os.FileMode) error + type Detector interface + Detect func(string, string) (string, bool, error) + type FileChecksum struct + Filename string + Hash hash.Hash + Type string + Value []byte + type FileDetector struct + func (d *FileDetector) Detect(src, pwd string) (string, bool, error) + type FileGetter struct + Copy bool + func (g *FileGetter) ClientMode(_ context.Context, u *url.URL) (ClientMode, error) + func (g *FileGetter) Get(_ context.Context, dst string, u *url.URL) error + func (g *FileGetter) Get(ctx context.Context, dst string, u *url.URL) error + func (g *FileGetter) GetFile(ctx context.Context, dst string, u *url.URL) error + func (g *FileGetter) SetClient(c *Client) + type FolderStorage struct + StorageDir string + func (s *FolderStorage) Dir(key string) (d string, e bool, err error) + func (s *FolderStorage) Get(ctx context.Context, key string, source string, update bool) error + type GCSDetector struct + func (d *GCSDetector) Detect(src, _ string) (string, bool, error) + type GCSGetter struct + FileSizeLimit int64 + func (g *GCSGetter) ClientMode(ctx context.Context, u *url.URL) (ClientMode, error) + func (g *GCSGetter) Get(ctx context.Context, dst string, u *url.URL) error + func (g *GCSGetter) GetFile(ctx context.Context, dst string, u *url.URL) error + func (g *GCSGetter) SetClient(c *Client) + type Getter interface + ClientMode func(context.Context, *url.URL) (ClientMode, error) + Get func(context.Context, string, *url.URL) error + GetFile func(context.Context, string, *url.URL) error + SetClient func(*Client) + type GitDetector struct + func (d *GitDetector) Detect(src, _ string) (string, bool, error) + type GitGetter struct + func (g *GitGetter) ClientMode(_ context.Context, u *url.URL) (ClientMode, error) + func (g *GitGetter) Get(ctx context.Context, dst string, u *url.URL) error + func (g *GitGetter) GetFile(ctx context.Context, dst string, u *url.URL) error + func (g *GitGetter) SetClient(c *Client) + type GitHubDetector struct + func (d *GitHubDetector) Detect(src, _ string) (string, bool, error) + type GitLabDetector struct + func (d *GitLabDetector) Detect(src, _ string) (string, bool, error) + type GzipDecompressor struct + FileSizeLimit int64 + func (d *GzipDecompressor) Decompress(dst, src string, dir bool, umask os.FileMode) error + type HgGetter struct + func (g *HgGetter) ClientMode(_ context.Context, _ *url.URL) (ClientMode, error) + func (g *HgGetter) Get(ctx context.Context, dst string, u *url.URL) error + func (g *HgGetter) GetFile(ctx context.Context, dst string, u *url.URL) error + func (g *HgGetter) SetClient(c *Client) + type HttpGetter struct + Client *http.Client + DoNotCheckHeadFirst bool + HeadFirstTimeout time.Duration + Header http.Header + MaxBytes int64 + Netrc bool + ReadTimeout time.Duration + XTerraformGetDisabled bool + XTerraformGetLimit int + func (g *HttpGetter) ClientMode(_ context.Context, u *url.URL) (ClientMode, error) + func (g *HttpGetter) Get(ctx context.Context, dst string, u *url.URL) error + func (g *HttpGetter) GetFile(ctx context.Context, dst string, src *url.URL) error + func (g *HttpGetter) SetClient(c *Client) + type MockGetter struct + GetCalled bool + GetDst string + GetErr error + GetFileCalled bool + GetFileDst string + GetFileErr error + GetFileURL *url.URL + GetURL *url.URL + Proxy Getter + func (g *MockGetter) ClientMode(_ context.Context, u *url.URL) (ClientMode, error) + func (g *MockGetter) Get(ctx context.Context, dst string, u *url.URL) error + func (g *MockGetter) GetFile(ctx context.Context, dst string, u *url.URL) error + func (g *MockGetter) SetClient(c *Client) + type ProgressTracker interface + TrackProgress func(src string, currentSize, totalSize int64, stream io.ReadCloser) (body io.ReadCloser) + type S3Detector struct + func (d *S3Detector) Detect(src, _ string) (string, bool, error) + type S3Getter struct + func (g *S3Getter) ClientMode(ctx context.Context, u *url.URL) (ClientMode, error) + func (g *S3Getter) Get(ctx context.Context, dst string, u *url.URL) error + func (g *S3Getter) GetFile(ctx context.Context, dst string, u *url.URL) error + func (g *S3Getter) SetClient(c *Client) + type Storage interface + Dir func(string) (string, bool, error) + Get func(context.Context, string, string, bool) error + type TarBzip2Decompressor struct + FileSizeLimit int64 + FilesLimit int + func (d *TarBzip2Decompressor) Decompress(dst, src string, dir bool, umask os.FileMode) error + type TarDecompressor struct + FileSizeLimit int64 + FilesLimit int + func (d *TarDecompressor) Decompress(dst, src string, dir bool, umask os.FileMode) error + type TarGzipDecompressor struct + FileSizeLimit int64 + FilesLimit int + func (d *TarGzipDecompressor) Decompress(dst, src string, dir bool, umask os.FileMode) error + type TarXzDecompressor struct + FileSizeLimit int64 + FilesLimit int + func (d *TarXzDecompressor) Decompress(dst, src string, dir bool, umask os.FileMode) error + type TarZstdDecompressor struct + FileSizeLimit int64 + FilesLimit int + func (d *TarZstdDecompressor) Decompress(dst, src string, dir bool, umask os.FileMode) error + type TestDecompressCase struct + Dir bool + DirList []string + Err bool + FileMD5 string + Input string + Mtime *time.Time + type XzDecompressor struct + FileSizeLimit int64 + func (d *XzDecompressor) Decompress(dst, src string, dir bool, umask os.FileMode) error + type ZipDecompressor struct + FileSizeLimit int64 + FilesLimit int + func (d *ZipDecompressor) Decompress(dst, src string, dir bool, umask os.FileMode) error + type ZstdDecompressor struct + FileSizeLimit int64 + func (d *ZstdDecompressor) Decompress(dst, src string, dir bool, umask os.FileMode) error