zipstream

package module
v0.0.0-...-1f07753 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: BSD-3-Clause Imports: 11 Imported by: 0

README

ZipStream - Reads zip files from io.Reader

Doesn't yet support Zip64 archives - see help wanted below.

Author

http://richard.warburton.it/

Documentation

http://godoc.org/github.com/krolaw/zipstream

History

https://github.com/golang/go/issues/10568

Help Wanted

I'm looking for some small zip64 archives to play with.

Documentation

Overview

Package zipstream provides support for reading ZIP archives through an io.Reader.

Zip64 archives are not yet supported.

Index

Constants

View Source
const (
	Store   uint16 = 0
	Deflate uint16 = 8
)

Compression methods.

Variables

This section is empty.

Functions

func RegisterDecompressor

func RegisterDecompressor(method uint16, d Decompressor)

RegisterDecompressor allows custom decompressors for a specified method ID.

Types

type Decompressor

type Decompressor func(io.Reader) io.ReadCloser

Decompressor is a function that wraps a Reader with a decompressing Reader. The decompressed ReadCloser is returned to callers who open files from within the archive. These callers are responsible for closing this reader when they're finished reading.

type Reader

type Reader struct {
	io.Reader
	// contains filtered or unexported fields
}

A Reader provides sequential access to the contents of a zip archive. A zip archive consists of a sequence of files, The Next method advances to the next file in the archive (including the first), and then it can be treated as an io.Reader to access the file's data. The Buffered method recovers any bytes read beyond the end of the zip file, necessary if you plan to process anything after it that is not another zip file.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader creates a new Reader reading from r.

func (*Reader) Buffered

func (r *Reader) Buffered() io.Reader

Buffered returns any bytes beyond the end of the zip file that it may have read. These are necessary if you plan to process anything after it, that isn't another zip file.

func (*Reader) Next

func (r *Reader) Next() (*zip.FileHeader, error)

Next advances to the next entry in the zip archive.

io.EOF is returned when the end of the zip file has been reached. If Next is called again, it will presume another zip file immediately follows and it will advance into it.

Jump to

Keyboard shortcuts

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