fileutil

package
v0.0.0-...-f6ab670 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Overview

Package fileutil contains utilities for working with the file system.

Package fileutil contains utilities for working with the file system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fileutil

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

func NewFileUtil

func NewFileUtil(log log.T) *Fileutil

func (*Fileutil) DeleteFile

func (futl *Fileutil) DeleteFile(filepath string) (err error)

DeleteFile deletes the specified file

func (*Fileutil) Exists

func (futl *Fileutil) Exists(filePath string) bool

Exists returns true if the given file exists, false otherwise, ignoring any underlying error

func (*Fileutil) GetFileMode

func (futl *Fileutil) GetFileMode(path string) (mode os.FileMode)

func (*Fileutil) LocalFileExist

func (futl *Fileutil) LocalFileExist(path string) (bool, error)

LocalFileExist returns true if the given file exists, false otherwise.

func (*Fileutil) MakeDirs

func (futl *Fileutil) MakeDirs(destinationDir string) (err error)

MakeDirs create the directories along the path if missing.

func (*Fileutil) ReadAllText

func (futl *Fileutil) ReadAllText(filePath string) (text string, err error)

ReadAllText reads all content from the specified file

func (*Fileutil) Uncompress

func (futl *Fileutil) Uncompress(log log.T, src, dest string) error

Uncompress untar the installation package

func (*Fileutil) Unzip

func (futl *Fileutil) Unzip(src, dest string) error

Unzip unzips the installation package (using platform agnostic zip functionality) For platform specific implementation that uses tar.gz on Linux, use Uncompress

func (*Fileutil) WriteAllText

func (futl *Fileutil) WriteAllText(filePath string, text string) (err error)

WriteAllText writes all text content to the specified file

type IFileutil

type IFileutil interface {
	DeleteFile(filepath string) (err error)
	ReadAllText(filePath string) (text string, err error)
	WriteAllText(filePath string, text string) (err error)
	Exists(filePath string) bool
	LocalFileExist(path string) (bool, error)
	MakeDirs(destinationDir string) (err error)
	GetFileMode(path string) (mode os.FileMode)
	Unzip(src, dest string) error
}

type IosFS

type IosFS interface {
	IsNotExist(err error) bool
	MkdirAll(path string, perm os.FileMode) error
	Open(name string) (*os.File, error)
	Remove(name string) error
	Rename(oldpath string, newpath string) error
	Stat(name string) (os.FileInfo, error)
	WriteFile(filename string, data []byte, perm os.FileMode) error
}

Directories

Path Synopsis
Package artifact contains utilities for working downloading files.
Package artifact contains utilities for working downloading files.

Jump to

Keyboard shortcuts

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