v0.0.8 Latest Latest

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

Go to latest
Published: Oct 21, 2021 License: MIT Imports: 15 Imported by: 0




This section is empty.


View Source
var (
	Reset   = "\033[0m"
	Red     = "\033[31m"
	Green   = "\033[32m"
	Yellow  = "\033[33m"
	Blue    = "\033[34m"
	Purple  = "\033[35m"
	Cyan    = "\033[36m"
	Gray    = "\033[37m"
	White   = "\033[97m"
	Notice  = Cyan
	Warn    = Yellow
	Fatal   = Red
	Success = Green



func Checksum

func Checksum(content string) (string, error)

Checksum retrive the checksum for given content

func Chmod

func Chmod(file string, perm fs.FileMode) error

Chmod apply permissions to file

func Chown

func Chown(file string, user int, group int) error

Chown apply user and group ownership to file

func Copy

func Copy(origin string, destination string) error

Copy the origin file into destination

func Delete

func Delete(file string) error

Delete remove a file

func Dir

func Dir(path string) string

Return the clean directory path for file

func EnsureDirectory

func EnsureDirectory(file string) error

EnsureDirectory makes sure directory exists from file path

func Exec

func Exec(cmd string, args ...string) (string, error)

Exec run command with given arguments

func Exist

func Exist(path string) bool

Exist check if file or directory exists

func Extension

func Extension(file string) string

Return the clean file extension, with dot

func File

func File(path string) string

Return the clean file name for path, with extension

func Find

func Find(root string, names []string) ([]string, error)

Find retrieve files from path that exactly match names

func FindMatch

func FindMatch(root string, patterns []string) ([]string, error)

FindMatch retrieve files from path that match patterns

func Info

func Info(file string) (string, string, fs.FileMode)

Info read and return file information: content, checksum and permissions

func List

func List(root string) ([]string, error)

List walks on path and return every found file

func Move

func Move(origin string, destination string) error

Move a file to destination

func Name

func Name(path string) string

Return the clean file name for path, without extension

func NoColor added in v0.0.8

func NoColor() bool

NoColor check if should avoid color output on console

func NodeRequire added in v0.0.5

func NodeRequire(command string, pkg string) error

Check if node package command exists, otherwise, try to install the package

func Permissions

func Permissions(path string) (fs.FileMode, error)

Permissions retrieve permissions for file or directory

func Printf

func Printf(color string, format string, args ...interface{})

Print a info to standard output

func Read

func Read(file string) (string, error)

Read retrieve content from file

func ReadMany

func ReadMany(files []string) (string, error)

ReadMany retrieve merged content from file list

func Rename

func Rename(origin string, destination string) error

Rename a file name

func Walk

func Walk(root string, callback WalkCallback) error

Walk find files in path and process callback for every result

func Watch

func Watch(path string, interval time.Duration, onChange WatchCallback, onDelete WatchCallback)

Watch check for changes on path files and trigger events on change or on delete file

func Write

func Write(file string, content string, perm fs.FileMode) error

Write content on file


type WalkCallback

type WalkCallback func(path string) error

WalkCallback type

type WatchCallback

type WatchCallback func(path string) error

WalkCallback type

Jump to

Keyboard shortcuts

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