Documentation ¶
Index ¶
- func Copy(ctx context.Context, dst io.Writer, src io.Reader, opts ...FileOption) error
- func CopyFile(ctx context.Context, dstFile, srcFile string, opts ...FileOption) error
- func CopyReader(ctx context.Context, dstFile string, src io.Reader, opts ...FileOption) error
- func CopyWriter(ctx context.Context, dst io.Writer, srcFile string, opts ...FileOption) error
- func Create(ctx context.Context, file string, opts ...FileOption) (io.WriteCloser, error)
- func Open(ctx context.Context, file string, opts ...FileOption) (io.ReadCloser, error)
- func Stat(ctx context.Context, file string, opts ...FileOption) (os.FileInfo, error)
- type CopyProgress
- type FileOption
- type FileOptions
- type FileUtil
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyFile ¶
func CopyFile(ctx context.Context, dstFile, srcFile string, opts ...FileOption) error
CopyFile ..
func CopyReader ¶
CopyReader ..
func CopyWriter ¶
CopyWriter ..
func Create ¶
func Create(ctx context.Context, file string, opts ...FileOption) (io.WriteCloser, error)
Create creates a writer
func Open ¶
func Open(ctx context.Context, file string, opts ...FileOption) (io.ReadCloser, error)
Open opens a reader
Types ¶
type FileOption ¶
type FileOption func(*FileOptions) error
FileOption ...
func WithProgress ¶
func WithProgress(totalSize int64, progress CopyProgress) FileOption
WithProgress ...
type FileOptions ¶
type FileOptions struct { // Context the context Context context.Context // TotalSize the size of source TotalSize int64 // Progress the progress callback Progress CopyProgress // Envs the local enviorment variables Envs map[string]string }
FileOptions ...
type FileUtil ¶
type FileUtil interface { // Stat .. Stat(ctx context.Context, file string, opts ...FileOption) (os.FileInfo, error) // Create creates a writer Create(ctx context.Context, file string, opts ...FileOption) (io.WriteCloser, error) // Open opens a reader Open(ctx context.Context, file string, opts ...FileOption) (io.ReadCloser, error) // Copy .. Copy(ctx context.Context, dst io.Writer, src io.Reader, opts ...FileOption) error // CopyFile .. CopyFile(ctx context.Context, dstFile, srcFile string, opts ...FileOption) error // CopyReader .. CopyReader(ctx context.Context, dstFile string, src io.Reader, opts ...FileOption) error // CopyWriter .. CopyWriter(ctx context.Context, dst io.Writer, srcFile string, opts ...FileOption) error }
FileUtil file utilties
var ( // Default default file util Default FileUtil = &defaultHandler{ fileHandler: &fileHandler{}, s3Handler: &s3Handler{}, httpHandler: &httpHandler{}, } )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.