lzo

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 11 Imported by: 8

README

lzo

lzo implements reading and writing of lzo format compressed files for Go, following lzop format. It uses the lzo C library underneath.

Installation

Download and install :

$ go get github.com/cyberdelia/lzo

Add it to your code :

import "github.com/cyberdelia/lzo"

Command line tool

Download and install:

$ go get github.com/cyberdelia/lzo/cmd/lzop

Compress and decompress:

$ lzop testdata/pg135.txt
$ lzop -d testdata/pg135.txt.lzo

Documentation

Index

Constants

View Source
const (
	// BestSpeed provides speed over better compression.
	BestSpeed = 3
	// BestCompression provides better compression over speed.
	BestCompression = 9
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	ModTime time.Time
	Name    string
	// contains filtered or unexported fields
}

Header metadata about the compressed file. This header is exposed as the fields of the Writer and Reader structs.

type Reader

type Reader struct {
	Header
	// contains filtered or unexported fields
}

A Reader is an io.Reader that can be read to retrieve uncompressed data from a lzop-format compressed file.

func NewReader

func NewReader(r io.Reader) (*Reader, error)

NewReader creates a new Reader reading the given reader.

func (*Reader) Close

func (z *Reader) Close() error

Close closes the Reader. It does not close the underlying io.Reader.

func (*Reader) Read

func (z *Reader) Read(p []byte) (int, error)

type Writer

type Writer struct {
	Header
	// contains filtered or unexported fields
}

A Writer is an io.Write that satisfies writes by compressing data written to its wrapped io.Writer.

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter creates a new Writer that satisfies writes by compressing data written to w.

func NewWriterLevel

func NewWriterLevel(w io.Writer, level int) (*Writer, error)

NewWriterLevel is like NewWriter but specifies the compression level instead of assuming DefaultCompression.

func (*Writer) Close

func (z *Writer) Close() error

Close closes the Writer. It does not close the underlying io.Writer.

func (*Writer) Reset

func (z *Writer) Reset(w io.Writer)

Reset discards the Writer's state and makes it equivalent to the result of its original state from NewWriter or NewWriterLevel, but writing to w instead. This permits reusing a Writer rather than allocating a new one.

func (*Writer) Write

func (z *Writer) Write(p []byte) (int, error)

Write writes a compressed form of p to the underlying io.Writer.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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