📚 higgs - Awesome Go Library for File Handling
A tiny cross-platform Go library to hide/unhide files and directories.
🏷️ File Handling
📂 Libraries for handling files and file systems.
⭐ 24 stars
Detailed Description of higgs
higgs
A tiny cross-platform Go library to hide or unhide files and directories.
Supported OSs: All unix based OSs (Tested on Ubuntu, MacOS), Windows
Installation
$ go get github.com/dastoori/higgs
Usage
package main
import (
"fmt"
"github.com/dastoori/higgs"
)
func main() {
path := "foo.txt"
// Hiding a file
newPath, err := higgs.Hide(path)
// NOTE: On Unix after hiding the file the file name
// will be changed to `.foo.txt` and `newPath` contains
// the new file name
if err != nil {
fmt.Println(err)
}
// Unhiding a file
newPath, err = higgs.Unhide(newPath)
if err != nil {
fmt.Println(err)
}
// Setting unix overwrite option (disable by default)
fh := NewFileHide(".bar.txt", UnixOverwriteOption(true))
// NOTE: On Unix if a `bar.txt` file exists, it will be
// overwritten after unhiding `.bar.txt`
err := fh.Unhide()
if err != nil {
fmt.Println(err)
}
// NOTE: `fh.Path` contains the new file name
}
License
MIT