https://github.com/dastoori/higgs
A tiny cross-platform Go library to hide/unhide files and directories
https://github.com/dastoori/higgs
directory file file-handling fs go golang hidden hidden-files hide hide-files hide-folder higgs macos ubuntu unix windows
Last synced: about 1 month ago
JSON representation
A tiny cross-platform Go library to hide/unhide files and directories
- Host: GitHub
- URL: https://github.com/dastoori/higgs
- Owner: dastoori
- License: mit
- Created: 2020-12-13T18:33:10.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-01-29T13:29:27.000Z (about 3 years ago)
- Last Synced: 2024-07-31T20:51:28.829Z (9 months ago)
- Topics: directory, file, file-handling, fs, go, golang, hidden, hidden-files, hide, hide-files, hide-folder, higgs, macos, ubuntu, unix, windows
- Language: Go
- Homepage:
- Size: 30.3 KB
- Stars: 22
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - higgs - A tiny cross-platform Go library to hide/unhide files and directories. (File Handling / Search and Analytic Databases)
- awesome-go-extra - higgs - platform Go library to hide/unhide files and directories|11|3|0|2020-12-13T18:33:10Z|2022-01-29T13:29:27Z| (File Handling / Advanced Console UIs)
README
# 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
[](https://github.com/dastoori/higgs/actions/workflows/unix.yml)
[](https://github.com/dastoori/higgs/actions/workflows/windows.yml)
[](https://codecov.io/gh/dastoori/higgs)
[](https://github.com/dastoori/higgs/releases)
[](https://pkg.go.dev/github.com/dastoori/higgs)

[](https://goreportcard.com/report/github.com/dastoori/higgs)
[](https://github.com/dastoori/higgs/blob/master/LICENSE)
[](https://github.com/avelino/awesome-go)## Installation
```sh
$ go get github.com/dastoori/higgs
```## Usage
```go
package mainimport (
"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 nameif 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