aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/otiai10/copy/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/otiai10/copy/README.md')
-rw-r--r--vendor/github.com/otiai10/copy/README.md108
1 files changed, 108 insertions, 0 deletions
diff --git a/vendor/github.com/otiai10/copy/README.md b/vendor/github.com/otiai10/copy/README.md
new file mode 100644
index 0000000..1cc8fc8
--- /dev/null
+++ b/vendor/github.com/otiai10/copy/README.md
@@ -0,0 +1,108 @@
1# copy
2
3[![Go Reference](https://pkg.go.dev/badge/github.com/otiai10/copy.svg)](https://pkg.go.dev/github.com/otiai10/copy)
4[![Actions Status](https://github.com/otiai10/copy/workflows/Go/badge.svg)](https://github.com/otiai10/copy/actions)
5[![codecov](https://codecov.io/gh/otiai10/copy/branch/main/graph/badge.svg)](https://codecov.io/gh/otiai10/copy)
6[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/otiai10/copy/blob/main/LICENSE)
7[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fotiai10%2Fcopy.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fotiai10%2Fcopy?ref=badge_shield)
8[![CodeQL](https://github.com/otiai10/copy/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/otiai10/copy/actions/workflows/codeql-analysis.yml)
9[![Go Report Card](https://goreportcard.com/badge/github.com/otiai10/copy)](https://goreportcard.com/report/github.com/otiai10/copy)
10[![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/otiai10/copy?sort=semver)](https://pkg.go.dev/github.com/otiai10/copy)
11[![Docker Test](https://github.com/otiai10/copy/actions/workflows/docker-test.yml/badge.svg)](https://github.com/otiai10/copy/actions/workflows/docker-test.yml)
12[![Vagrant Test](https://github.com/otiai10/copy/actions/workflows/vagrant-test.yml/badge.svg)](https://github.com/otiai10/copy/actions/workflows/vagrant-test.yml)
13
14`copy` copies directories recursively.
15
16# Example Usage
17
18```go
19package main
20
21import (
22 "fmt"
23 cp "github.com/otiai10/copy"
24)
25
26func main() {
27 err := cp.Copy("your/src", "your/dest")
28 fmt.Println(err) // nil
29}
30```
31
32# Advanced Usage
33
34```go
35// Options specifies optional actions on copying.
36type Options struct {
37
38 // OnSymlink can specify what to do on symlink
39 OnSymlink func(src string) SymlinkAction
40
41 // OnDirExists can specify what to do when there is a directory already existing in destination.
42 OnDirExists func(src, dest string) DirExistsAction
43
44 // OnError can let users decide how to handle errors (e.g., you can suppress specific error).
45 OnError func(src, dest, string, err error) error
46
47 // Skip can specify which files should be skipped
48 Skip func(srcinfo os.FileInfo, src, dest string) (bool, error)
49
50 // PermissionControl can control permission of
51 // every entry.
52 // When you want to add permission 0222, do like
53 //
54 // PermissionControl = AddPermission(0222)
55 //
56 // or if you even don't want to touch permission,
57 //
58 // PermissionControl = DoNothing
59 //
60 // By default, PermissionControl = PreservePermission
61 PermissionControl PermissionControlFunc
62
63 // Sync file after copy.
64 // Useful in case when file must be on the disk
65 // (in case crash happens, for example),
66 // at the expense of some performance penalty
67 Sync bool
68
69 // Preserve the atime and the mtime of the entries
70 // On linux we can preserve only up to 1 millisecond accuracy
71 PreserveTimes bool
72
73 // Preserve the uid and the gid of all entries.
74 PreserveOwner bool
75
76 // The byte size of the buffer to use for copying files.
77 // If zero, the internal default buffer of 32KB is used.
78 // See https://golang.org/pkg/io/#CopyBuffer for more information.
79 CopyBufferSize uint
80
81 // If you want to add some limitation on reading src file,
82 // you can wrap the src and provide new reader,
83 // such as `RateLimitReader` in the test case.
84 WrapReader func(src io.Reader) io.Reader
85
86 // If given, copy.Copy refers to this fs.FS instead of the OS filesystem.
87 // e.g., You can use embed.FS to copy files from embedded filesystem.
88 FS fs.FS
89}
90```
91
92```go
93// For example...
94opt := Options{
95 Skip: func(info os.FileInfo, src, dest string) (bool, error) {
96 return strings.HasSuffix(src, ".git"), nil
97 },
98}
99err := Copy("your/directory", "your/directory.copy", opt)
100```
101
102# Issues
103
104- https://github.com/otiai10/copy/issues
105
106
107## License
108[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fotiai10%2Fcopy.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fotiai10%2Fcopy?ref=badge_large) \ No newline at end of file