copy

package module
v2.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2025 License: MIT Imports: 11 Imported by: 0

README

copy

Simple copy module for go applications, which allows to create copies of files and folders.

Installation

go get github.com/emar-kar/copy/v2

Available options

  • WithBufferSize: allows to set custom buffer size for file copy. If provided size <= 0, then default 65536 bytes will be used.
  • WithExcludeFunc: allows to set custom function to exclude paths.
  • Force: re-writes destination if it already exists.
  • WithNoFollow: creates symlinks instead of resolving paths.
Paths processing

If you need to copy file or folder with the same name as source in destination, just add trailing slash at the destination path, since it will consider the last path element as the file name.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSame = errors.New("same location")

Functions

func Copy

func Copy(ctx context.Context, src, dst string, opts ...optFunc) error

func Force

func Force(o *options)

Force rewrites destination if it already exists.

func WithBufferSize

func WithBufferSize(i int) optFunc

WithBufferSize allows to set custom buffer size for file copy. If provided size is <= 0, then default will be used.

func WithExcludeFunc

func WithExcludeFunc(fn excludeFunc) optFunc

WithExcludeFunc allows to filter files and folders by path.

func WithNoFollow

func WithNoFollow(o *options)

WithNoFollow creates symlinks instead of resolving path and copying the contents.

Types

This section is empty.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL