Add support for embed directories
4k1k0 opened this issue · comments
Wako commented
It would be super useful if this package could copy embed directories.
For example:
Given the following fs tree:
/
/assets
/foo
foo.txt
bar.txt
hello.txt
goodbye.txt
main.go
It could use the embed FS to use the copy function.
//go:embed assets
var assets embed.FS
func foo() error {
file, err := assets.Open("assets")
if err != nil {
return err
}
err := Copy(file, "destination")
if err != nil {
return err
}
return nil
}
Or maybe use the Option structure
opt := Options{
FS: assets,
}
err := Copy("assets/foo", "new/destination", opt)
Hiromu OCHIAI commented
Thank you for your feedback. Let me take time to think of it
Tomás Warynyca commented
@otiai10 is this planned to be implemented?
Hiromu OCHIAI commented
will tackle it this weekend ;)
Hiromu OCHIAI commented
See v1.12.0