fileutil

package
v62.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateSHA256

func CalculateSHA256(file string) (hash string, err error)

func Copy

func Copy(dst, src string) (nBytes int64, err error)

func CopyToTempFile

func CopyToTempFile(src string) (tempFilePath string, err error)

func CreateDir

func CreateDir(dir string) error

func CreateFile

func CreateFile(file string) (err error)

func GetPermissions

func GetPermissions(path string) (string, func() error, error)

func SecureFiles

func SecureFiles(filepaths ...string) (err error)

SecureFiles makes the current user/group the owner of all files in filepaths, with 0600 file permissions.

func Unarchive

func Unarchive(source, destination, format string) error

func Unzip

func Unzip(b []byte, dest string) error

This is a modified version of http://stackoverflow.com/questions/20357223/easy-way-to-unzip-file-with-golang to work with in memory zip, rather than a file

func WriteToFileAsJSON

func WriteToFileAsJSON(obj interface{}, filename string) error

Types

type File

type File struct {
	Description string `json:"description"`
	Path        string `json:"path"`
	Content     string `json:"content"`
	Encoding    string `json:"encoding"`
	Format      string `json:"format"`
}

func (File) Extract

func (f File) Extract() error

func (File) ExtractFile

func (f File) ExtractFile() error

func (File) ExtractZip

func (f File) ExtractZip() error

Jump to

Keyboard shortcuts

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