fileutil

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseFile

func CloseFile(file io.Closer) error

func CopyFile

func CopyFile(ctx context.Context, from string, to string) error

func CreateFile

func CreateFile(fileName string, isDir bool) error

func DeleteFile

func DeleteFile(filename string) error

func FileExists

func FileExists(filename string) (bool, error)

func FileStats added in v0.6.0

func FileStats(filename string) (storage.Object, error)

func GetPathType

func GetPathType(path string) string

func NewFileWriter

func NewFileWriter(filename string, contentType string) (io.WriteCloser, error)

func OpenFile

func OpenFile(filename string) (io.ReadCloser, error)

func PathJoinSafe

func PathJoinSafe(elem ...string) string

PathJoinSafe wrapper around filepath.Join to ensure that paths are correctly constructed if the path is a normal OS path, just use filepath.Join if the path is S3, trim any trailing slashes and construct it manually from the components so that double slashes (e.g. s3://) are preserved.

func ReadFileBytes

func ReadFileBytes(filename string) ([]byte, error)

func ReadLine

func ReadLine(r *bufio.Reader) ([]byte, error)

ReadLine returns a single line (without the ending \n) from the input buffered reader. An error is returned if there is an error with the buffered reader. This function is needed to avoid the 65K char line limit.

func WalkDir

func WalkDir() func(ctx context.Context, URL string, handler storage.OnVisit, options ...storage.Option) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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