Documentation ¶
Index ¶
- func CompressByFileType(file string, out io.WriteCloser) io.WriteCloser
- func IsGzip(path string) bool
- func NewAtomicWriterCompressed(path string, perm os.FileMode) (io.WriteCloser, error)
- func OpenCompressed(file string, flag int, perm os.FileMode) (io.WriteCloser, error)
- func OpenDecompressed(path string) (io.ReadCloser, error)
- func WriteCompressedJson(file string, obj any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompressByFileType ¶ added in v1.3.0
func CompressByFileType(file string, out io.WriteCloser) io.WriteCloser
func IsGzip ¶
IsGzip determines if a path points to a gzip compressed file. Returns true when the file has a .gz extension.
func NewAtomicWriterCompressed ¶ added in v1.3.0
NewAtomicWriterCompressed creates a io.WriteCloser that performs an atomic write. The contents are initially written to a temporary file and only renamed into place when the writer is closed. NOTE: It's vital to check if an error is returned from Close() as it may indicate the file could not be renamed If path ends in .gz the contents written will be gzipped.
func OpenCompressed ¶
OpenCompressed opens a file for writing and automatically compresses the content if the filename ends with .gz
func OpenDecompressed ¶
func OpenDecompressed(path string) (io.ReadCloser, error)
OpenDecompressed opens a reader for the specified file and automatically gzip decompresses the content if the filename ends with .gz
func WriteCompressedJson ¶
WriteCompressedJson writes the object to the specified file as a compressed json object if the filename ends with .gz.
Types ¶
This section is empty.