vfscopy/README.md

36 lines
753 B
Markdown
Raw Normal View History

2020-10-23 20:29:09 +00:00
# vfscopy
Copy a Virtual FileSystem, such as
[http.FileSystem](https://golang.org/pkg/net/http/#FileSystem),
recursively to a native file system destination.
2020-10-23 21:30:03 +00:00
Works with any file system that implements http.FileSystem,
such as `vfsgen`, `fileb0x`, `gobindata`.
2020-10-23 20:29:09 +00:00
```go
httpfs := http.Dir("/tmp/public/")
vfs := vfscopy.NewVFS(httpfs)
if err := Copy(vfs, ".", "/tmp/dst/"); nil != err {
fmt.Fprintf(os.Stderr, "couldn't copy vfs: %v\n", err)
}
```
## Test
```bash
2020-10-23 21:30:03 +00:00
# Generate the test virtual file system
go generate ./...
2020-10-23 21:30:03 +00:00
# Run the tests
go test ./...
```
2020-10-23 21:30:03 +00:00
# License
The MIT License (MIT)
We used the recursive native file system copy implementation at
https://github.com/otiai10/copy as a starting point and added
virtual file system support.