tgzfile

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package tgzfile provides functionality related to gzipped tar files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(filename string, files map[string]string) error

Create creates a tar.gz file containing the given files. File permissions are mirrored from the file system.

files := map[string]string{
  "./testdata/create-1.txt": "execute-me", // source file name : destination file name
  "./testdata/create-2.txt": "data/f2.txt",
}

err := Create("test.tar.gz", files)

func CreatePermissionFunc

func CreatePermissionFunc(filename string, files map[string]string, permissions func(string) int64) error

CreatePermissionFunc creates a tar.gz file containing the given files. File permissions may be changed by the permission func.

files := map[string]string{
  "./testdata/create-1.txt": "execute-me", // source file name : destination file name
  "./testdata/create-2.txt": "data/f2.txt",
}

permissions := func(filename string) int64 {
  if filename == "execute-me" {
    return 0777 // Overwrite permissions
  }

  return -1 // Use permissions from file system
}

err := CreatePermissionFunc("test.tar.gz", files, permissions)

Types

This section is empty.

Jump to

Keyboard shortcuts

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