Documentation ¶
Overview ¶
Package file contains utilities for operating on files.
Index ¶
- func Append(name string, content []byte) error
- func Compress(name string, w io.Writer) io.WriteCloser
- func Copy(oldpath, newpath string) error
- func Create(name string) error
- func Decompress(name string, r io.Reader) (io.ReadCloser, error)
- func DownloadWithCache(ctx context.Context, cacheDir, src, dest string, mode fs.FileMode, quiet bool) error
- func DownloadWithCacheAndExtract(ctx context.Context, cacheDir, src, dest string, match string, ...) error
- func Exists(name string) bool
- func MkdirAll(name string) error
- func Open(name string) (io.WriteCloser, error)
- func Read(name string) ([]byte, error)
- func Remove(name string) error
- func RemoveAll(name string) error
- func Rename(oldpath, newpath string) error
- func Write(name string, content []byte) error
- func WriteWithMode(name string, content []byte, mode os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compress ¶ added in v0.5.0
func Compress(name string, w io.Writer) io.WriteCloser
Compress compresses a writer
func Decompress ¶ added in v0.5.0
Decompress decompresses a reader It will return a raw reader if the reader is not compressed
func DownloadWithCache ¶
func DownloadWithCache(ctx context.Context, cacheDir, src, dest string, mode fs.FileMode, quiet bool) error
DownloadWithCache downloads the src file to the dest file.
func DownloadWithCacheAndExtract ¶
func DownloadWithCacheAndExtract(ctx context.Context, cacheDir, src, dest string, match string, mode fs.FileMode, quiet bool, clean bool) error
DownloadWithCacheAndExtract downloads the src file to the dest file, and extract it to the dest directory.
func Open ¶ added in v0.3.0
func Open(name string) (io.WriteCloser, error)
Open opens/creates a file for writing.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.