Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
deatil committed Dec 10, 2024
1 parent d41cdc2 commit 731db6d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,28 @@ go get -u github.com/deatil/go-filesystem

~~~go
import (
"fmt"

"github.com/deatil/go-filesystem/filesystem"
local_adapter "github.com/deatil/go-filesystem/filesystem/adapter/local"
)

func goFilesystem() {
func main() {
// 根目录
root := "/storage"
adapter := local_adapter.New(root)

// 磁盘
fs := filesystem.New(adapter)

// 使用
// 写入数据
path := "/path.txt"
contents := []byte("")
fs.Write(path, contents) (bool, error)

ok, err := fs.Write(path, contents)
if err != nil {
fmt.Println(err.Error())
}
}
~~~

Expand Down

0 comments on commit 731db6d

Please sign in to comment.