Documentation
¶
Index ¶
- Variables
- func Checksum(content string) (string, error)
- func Chmod(file string, perm fs.FileMode) error
- func Chown(file string, user int, group int) error
- func Copy(origin string, destination string) error
- func Delete(file string) error
- func Dir(path string) string
- func EnsureDirectory(file string) error
- func Exec(cmd string, args ...string) (string, error)
- func Exist(path string) bool
- func Extension(file string) string
- func File(path string) string
- func Info(file string) (string, string, fs.FileMode)
- func List(root string) ([]string, error)
- func Name(path string) string
- func NoColor() bool
- func NodeRequire(command string, pkg string) error
- func Permissions(path string) (fs.FileMode, error)
- func Printf(color string, format string, args ...interface{})
- func RandomString(n int) string
- func Read(file string) (string, error)
- func Relative(path string, root string) string
- func Rename(origin string, destination string) error
- func Replace(file string, search string, replace string) error
- func Resolve(file string, extensions []string, path string) string
- func Server(root string, port string, onRequest RequestCallback) error
- func TemporaryFile(file string) string
- func Watch(root string, onChange WatchCallback) error
- func WatchCheckFile(file string, onChange WatchCallback) error
- func Write(file string, content string, perm fs.FileMode) error
- type RequestCallback
- type WatchCallback
Constants ¶
This section is empty.
Variables ¶
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 )
Colors
Functions ¶
func EnsureDirectory ¶
EnsureDirectory makes sure directory exists from file path
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
NodeRequire check if node package command exists, otherwise, try to install the package
func Permissions ¶
Permissions retrieve permissions for file or directory
func RandomString ¶ added in v0.0.11
RandomString generates a random string from give size
func Resolve ¶ added in v0.0.15
Resolve will check paths with possible extensions until file is detected
func Server ¶ added in v0.1.0
func Server(root string, port string, onRequest RequestCallback) error
Server start a file server with given path and port
func TemporaryFile ¶ added in v0.0.11
TemporaryFile return a temporary file path
func Watch ¶
func Watch(root string, onChange WatchCallback) error
Watch will check if there is any change in the files inside path
func WatchCheckFile ¶ added in v0.1.0
func WatchCheckFile(file string, onChange WatchCallback) error
WatchCheckFile will check if file has been changed and run callback once necessary
Types ¶
type RequestCallback ¶ added in v0.1.0
RequestCallback type
Click to show internal directories.
Click to hide internal directories.