zipfile

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EOCDPrefetchBufferSize = 65536 // 64kb is more than enough
	Zip64HeaderId          = 0x0001
)

Variables

View Source
var (
	EOCDSignature   = []byte{0x50, 0x4b, 0x05, 0x06}
	EOCD64Signature = []byte{0x50, 0x4b, 0x06, 0x06}
)
View Source
var (
	ErrInvalidZip   = errors.New("invalid zip file")
	ErrFileNotFound = errors.New("file not found")
)

Functions

func ReaderForRecord

func ReaderForRecord(f *CDR, fetcher OffsetFetcher) (io.Reader, error)

Types

type CDLocation

type CDLocation struct {
	SizeBytes uint64
	Offset    uint64
	Zip64     bool
}

type CDR

type CDR struct {
	CompressionMethod     uint16
	Modified              time.Time
	CRC32Uncompressed     uint32
	CompressedSizeBytes   uint64
	UncompressedSizeBytes uint64
	Mode                  fs.FileMode
	LocalFileHeaderOffset uint64
	FileName              string
	ExtraFields           []byte
	FileComment           []byte
}

func ReadCDR

func ReadCDR(r io.Reader) (*CDR, error)

type CentralDirectoryParser

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

func NewCentralDirectoryParser

func NewCentralDirectoryParser(reader OffsetFetcher) *CentralDirectoryParser

func (*CentralDirectoryParser) GetCentralDirectory

func (p *CentralDirectoryParser) GetCentralDirectory() ([]*CDR, error)

func (*CentralDirectoryParser) Read

func (p *CentralDirectoryParser) Read(fileName string) (io.Reader, error)

type EOCD

type EOCD struct {
	Signature         uint32
	CurrentDiskNumber uint16
	CDDiskNumber      uint16
	DiskCDRs          uint16
	TotalCDRs         uint16
	CDSizeBytes       uint32
	CDByteOffset      uint32
}

type EOCD64

type EOCD64 struct {
	Signature              uint32
	SizeBytes              uint64
	CreatorVersion         uint16
	VersionNeededToExtract uint16
	CurrentDiskNumber      uint32
	CDDiskNumber           uint32
	DiskCDRs               uint64
	TotalCDRs              uint64
	CDSizeBytes            uint64
	CDByteOffset           uint64
}

type OffsetFetcher

type OffsetFetcher interface {
	Fetch(start, end *int64) (io.Reader, error)
}

type StorageAdapter

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

func NewStorageAdapter

func NewStorageAdapter(ctx context.Context, f remote.Fetcher) *StorageAdapter

func (*StorageAdapter) Fetch

func (z *StorageAdapter) Fetch(start, end *int64) (io.Reader, error)

Jump to

Keyboard shortcuts

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