A simple file manager library.
Package errors provides simple error handling primitives and behavioral errors.
go get github.com/chentex/go-fm
Read the package documentation for more information.
Every time you need to manage some files you tend to use the same code over and over, and you always have to test no matter how many times you have written the code.
This library is a wrapper for reading, writing and checking if files exists. It's already tested so you can use it without worrying to write the test for this module, and just focus on writing your code.
import "github.com/chentex/go-fm" fm
fileManager := fm.NewFileManager()
content, err := fm.OpenFile("yourfile.txt")
if err != nil {
fmt.Printf(err)
}
bytes := byte[]("sample text to insert in file")
err := fm.WriteFile("yourfile.txt", bytes, 0644)
if err != nil {
fmt.Printf(err)
}
exists, err := fm.ExistsFile("yourfile.txt")
if err != nil {
fmt.Printf(err)
}
fmt.Printf(exists)
I welcome pull requests, bug fixes and issue reports.
Maintainer: Vicente Zepeda (chente.z.m@gmail.com)