Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/herrjulz/mingoak
https://github.com/herrjulz/mingoak
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/herrjulz/mingoak
- Owner: herrjulz
- Created: 2017-09-02T18:13:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-16T10:08:53.000Z (over 7 years ago)
- Last Synced: 2024-10-28T13:32:39.687Z (2 months ago)
- Language: Go
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MinGOak
A lightweight, easy-to-use, in-memory file tree.
--> `mingoak` implements [os.FilePath](https://golang.org/pkg/os/#FileInfo)
```
$ go get github.com/JulzDiverse/mingoak
``````
import github.com/JulzDiverse/mingoak
```## Usage
```go
root := mingoak.MkRoot()
root.MkDirAll("path/to/dir/")
root.WriteFile("path/to/dir/file", []byte("test"))fileInfo, _ := root.ReadDir("path/to/dir")
for _, v := fileInfo {
pintln(v.IsDir()) //true or false
println(v.Name()) //name of file/dir
println(v.ModTime()) //modification time
println(v.Size()) //file size
}file, _ = root.ReadFile("path/to/dir/file")
//Walk also works:
files, _ := root.Walk("path")
for _, v := files {
fmt.Prinln(v) //prints the file path
}
```