utils

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package utils provides some utility functions to compress and decompress tar and tar.gz. It also provides a logger that can output in color and implements io.Writer.

Index

Constants

View Source
const MaxFileSizeBytes = 50 * 1024 * 1024 // 50MB
View Source
const MaxNameLength = 20

Variables

This section is empty.

Functions

func Compress

func Compress(path, outputPath string) error

Compress takes a path to a file or directory and creates a .tar.gzip file at the outputPath location.

func CompressTar

func CompressTar(path, outputPath string) error

CompressTar takes a path to a file or directory and creates a .tar file at the outputPath location.

func Decompress

func Decompress(tarPath, baseDir string) error

Decompress takes a location to a .tar.gzip file and a base path and decompresses the contents wrt the base path.

func DecompressTar

func DecompressTar(tarPath, baseDir string) error

DecompressTar takes a location to a .tar file and a base path and decompresses the contents wrt the base path.

func NewColorLogger

func NewColorLogger(name string, writer io.Writer, newColor bool) io.Writer

func TarCopy

func TarCopy(src, dst, tempDir string) error

TarCopy uses tar archive to copy src to dst to preserve the folder structure.

Types

type ColorLogger

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

ColorLogger provides an io.Writer that can output in color.

func (*ColorLogger) Write

func (c *ColorLogger) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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