file

package
v1.7.9 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package file provides file I/O functionality

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendFile added in v1.5.0

func AppendFile(ctx context.Context, target string, r io.Reader, perm fs.FileMode) (n int64, err error)

func CopyDir added in v1.5.0

func CopyDir(ctx context.Context, src, dst string) (err error)

func CopyFile added in v1.5.0

func CopyFile(ctx context.Context, src, dst string) (n int64, err error)

func CopyFileWithPerm added in v1.5.0

func CopyFileWithPerm(ctx context.Context, src, dst string, perm fs.FileMode) (n int64, err error)

func CreateTemp added in v1.5.1

func CreateTemp(baseDir string) (f *os.File, err error)

CreateTemp create temporary file from given base path if base path is nil temporary directory will create from Go's standard library

func Exists added in v1.2.1

func Exists(path string) (e bool)

Exists returns file existence

func ExistsWithDetail added in v1.2.1

func ExistsWithDetail(path string) (e bool, fi fs.FileInfo, err error)

ExistsWithDetail returns file existence with detailed information

func Join added in v1.5.0

func Join(paths ...string) (path string)

func ListInDir added in v1.2.1

func ListInDir(path string) ([]string, error)

ListInDir returns file list in directory

func MkdirAll added in v1.5.0

func MkdirAll(path string, perm fs.FileMode) (err error)

MkdirAll creates directory like mkdir -p

func MkdirTemp added in v1.5.0

func MkdirTemp(baseDir string) (path string, err error)

MkdirTemp create temporary directory from given base path if base path is nil temporary directory will create from Go's standard library

func MoveDir added in v1.5.0

func MoveDir(ctx context.Context, src, dst string) (err error)

func Open

func Open(path string, flg int, perm fs.FileMode) (file *os.File, err error)

Open opens the file with the given path, flag and permission. If the folder does not exists, create the folder. If the file does not exist, create the file.

func OverWriteFile added in v1.5.0

func OverWriteFile(ctx context.Context, target string, r io.Reader, perm fs.FileMode) (n int64, err error)

func ReadDir added in v1.5.1

func ReadDir(path string) (dirs []fs.DirEntry, err error)

func ReadFile added in v1.5.1

func ReadFile(path string) (n []byte, err error)

func WriteFile added in v1.5.0

func WriteFile(ctx context.Context, target string, r io.Reader, perm fs.FileMode) (n int64, err error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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