buildgolang.org/x/build/tarutil Index | Files

package tarutil

import "golang.org/x/build/tarutil"

Package tarutil contains utilities for working with tar archives.

Index

Types

type FileList

type FileList struct {
	// contains filtered or unexported fields
}

FileList is a list of entries in a tar archive which acts as a template to make .tar.gz io.Readers as needed.

The zero value is a valid empty list.

All entries must be added before calling OpenTarGz.

func (*FileList) AddHeader

func (fl *FileList) AddHeader(h *tar.Header)

AddHeader adds a non-regular file to the FileList.

func (*FileList) AddRegular

func (fl *FileList) AddRegular(h *tar.Header, size int64, content io.ReaderAt)

AddRegular adds a regular file to the FileList.

func (*FileList) TarGz

func (fl *FileList) TarGz() io.ReadCloser

TarGz returns an io.ReadCloser of a gzip-compressed tar file containing the contents of the FileList. All Add calls must happen before OpenTarGz is called. Callers must call Close on the returned ReadCloser to release resources.

Source Files

tarutil.go

Version
v0.0.0-20250421191922-3619c213cff3 (latest)
Published
Apr 21, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
2 months ago

Tools for package owners.