archive

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

README

archive

This package contains the archive module which is used to create compressed archives.

inputs

The inputs to this module:

  • paths a list of paths separated by new line, to add to the archive.
  • key a key to use for the archive file name.
  • options a list of options to pass to the archive library.

outputs

The outputs from this module:

  • archive the archive file.
  • sha256 the sha256 of the archive file.
  • size the size of the archive file.
  • stats the stats of the archive file.

path handling

We have two types of paths.

  • absolute paths are absolute paths to files or directories.
  • relative paths are relative to the current working directory.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchiveInfo

type ArchiveInfo struct {
	ArchivePath string
	Size        int64
	Sha256sum   string
	Stats       map[string]int64
}

func BuildArchive

func BuildArchive(ctx context.Context, paths []string, key string) (*ArchiveInfo, error)

type ChecksumSHA256

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

func NewChecksumSHA256

func NewChecksumSHA256(f io.Writer) *ChecksumSHA256

func (*ChecksumSHA256) Sum

func (c *ChecksumSHA256) Sum() string

func (*ChecksumSHA256) Write

func (c *ChecksumSHA256) Write(p []byte) (n int, err error)

implement the io.WriteCloser interface

type Mapping

type Mapping struct {
	Path         string
	ResolvedPath string
	RelativePath string
	Chroot       string
	Relative     bool
}

Mapping represents a mapping of a file path to a destination path, including the chroot path and whether the path is relative or not.

func PathsToMappings

func PathsToMappings(paths []string) ([]Mapping, error)

PathsToMappings takes a slice of file paths and returns a slice of Mapping structs, which contain information about the destination path, chroot path, and whether the path is relative or not. It handles paths starting with "~/" by replacing them with the user's home directory.

Jump to

Keyboard shortcuts

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