compress

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package compress mainly implements compression methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GzipWriter

type GzipWriter struct {
	// contains filtered or unexported fields
}

GzipWriter is a gzip compression writer

func NewGzipWriter

func NewGzipWriter(f *os.File) (gw *GzipWriter)

NewGzipWriter creates a gzip compression writer

func (*GzipWriter) Close

func (g *GzipWriter) Close() error

Close closes the writer

func (*GzipWriter) Write

func (g *GzipWriter) Write(p []byte) (n int, err error)

Write writes 'p'

type NoneWriter

type NoneWriter struct {
	// contains filtered or unexported fields
}

NoneWriter is a non-compression writer

func NewNoneWriter

func NewNoneWriter(f *os.File) (nw *NoneWriter)

NewNoneWriter creates a non-compression writer

func (*NoneWriter) Close

func (nw *NoneWriter) Close() error

Close closes the writer

func (*NoneWriter) Write

func (nw *NoneWriter) Write(p []byte) (n int, err error)

Write writes 'p'

type ReadCloser

type ReadCloser struct {
	io.Reader
}

ReadCloser is a read closer

func NewGzipReadCloser

func NewGzipReadCloser(f *os.File) (r *ReadCloser, err error)

NewGzipReadCloser retrieves a gzip compression read closer

func NewNoneReadCloser

func NewNoneReadCloser(f *os.File) *ReadCloser

NewNoneReadCloser retrieves a non-compression read closer

func NewZipReadCloser

func NewZipReadCloser(f *os.File) (r *ReadCloser, err error)

NewZipReadCloser retrieves a zip compression read closer

func (*ReadCloser) Close

func (r *ReadCloser) Close() error

Close closes the connection

func (*ReadCloser) Read

func (r *ReadCloser) Read(p []byte) (n int, err error)

Read reads 'p'

type Type

type Type string

Type represents the compression type

const (
	TypeNone    Type = ""
	TypeTarGzip Type = "targz"
	TypeTar     Type = "tar"
	TypeZip     Type = "zip"
	TypeGzip    Type = "gz"
)

CompressionTypeEnum enumerates the compression types

func (Type) ReadCloser

func (c Type) ReadCloser(f *os.File) (r io.ReadCloser, err error)

ReadCloser retrieves a read closer

func (Type) WriteCloser

func (c Type) WriteCloser(f *os.File) (w io.WriteCloser, err error)

WriteCloser retrieves a write closer

type ZipReader

type ZipReader struct {
	// contains filtered or unexported fields
}

ZipReader - A reader for ZIP files.

func NewZipReader

func NewZipReader(f *os.File) (zr *ZipReader, err error)

NewZipReader - Creates a ZIP reader using the file 'f'.

func (*ZipReader) Read

func (z *ZipReader) Read(p []byte) (n int, err error)

Read - Reads the content passed in 'p'.

type ZipWriter

type ZipWriter struct {
	// contains filtered or unexported fields
}

ZipWriter is a zip compression writer

func NewZipWriter

func NewZipWriter(f *os.File) (zw *ZipWriter, err error)

NewZipWriter creates a new zip compression writer

func (*ZipWriter) Close

func (z *ZipWriter) Close() error

Close closes the zip compression writer

func (*ZipWriter) Write

func (z *ZipWriter) Write(p []byte) (n int, err error)

Write is used to write data to the zip file

Jump to

Keyboard shortcuts

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