pinch

package
v0.0.0-...-7418a84 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2014 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(url, fn string) ([]byte, error)

Get a file from URL and filename (string)

func GetZipDirectory

func GetZipDirectory(url string) (map[string]ZipEntry, error)

GetZipDirectory Get the directory for a remote (url) zip archive

func GetZipFile

func GetZipFile(url string, entry ZipEntry) ([]byte, error)

GetZipFile Get a file from URL and ZipEntry

Types

type ZipDirRecord

type ZipDirRecord struct {
	CentralDirectoryFileHeaderSignature uint32
	VersionMadeBy                       uint16
	VersionNeededToExtract              uint16
	GeneralPurposeBitFlag               uint16
	CompressionMethod                   uint16
	FileLastModificationTime            uint16
	FileLastModificationDate            uint16
	Crc32                               uint32
	CompressedSize                      uint32
	UncompressedSize                    uint32
	FileNameLength                      uint16
	ExtraFieldLength                    uint16
	FileCommentLength                   uint16
	DiskNumberWhereFileStarts           uint16
	InternalFileAttributes              uint16
	ExternalFileAttributesL             uint16 // split in low+high for struct packing
	ExternalFileAttributesH             uint16
	RelativeOffsetOfLocalFileHeaderL    uint16 // split in low+high for struct packing
	RelativeOffsetOfLocalFileHeaderH    uint16
}

ZipDirRecord zip archive directory record, see http://en.wikipedia.org/wiki/ZIP_(file_format)#File_headers

func (*ZipDirRecord) CombinedLength

func (d *ZipDirRecord) CombinedLength() int32

CombinedLength calculate the combined length of the record + filename + extra fields

func (*ZipDirRecord) ExternalFileAttributes

func (d *ZipDirRecord) ExternalFileAttributes() uint32

ExternalFileAttributes get the attribute field from its high and low parts

func (*ZipDirRecord) RelativeOffset

func (d *ZipDirRecord) RelativeOffset() uint32

RelativeOffset get the relative offset field from its high and low parts

type ZipEndRecord

type ZipEndRecord struct {
	EndOfCentralDirectorySignature            uint32
	NumberOfThisDisk                          uint16
	DiskWhereCentralDirectoryStarts           uint16
	NumberOfCentralDirectoryRecordsOnThisDisk uint16
	TotalNumberOfCentralDirectoryRecords      uint16
	SizeOfCentralDirectory                    uint32
	OffsetOfStartOfCentralDirectory           uint32
	ZipfileCommentLength                      uint16
}

ZipEndRecord zip archive end record, see http://en.wikipedia.org/wiki/ZIP_(file_format)#File_headers

func (*ZipEndRecord) EndOffset

func (r *ZipEndRecord) EndOffset() int64

EndOffset get the offset of the end of the zip archive directory

func (*ZipEndRecord) StartOffset

func (r *ZipEndRecord) StartOffset() int64

StartOffset get the offset of the zip archive directory

type ZipEntry

type ZipEntry struct {
	Filename                        string
	CompressedSize                  uint32
	UncompressedSize                uint32
	CompressionMethod               uint16
	ExtraFieldLength                uint16
	RelativeOffsetOfLocalFileHeader uint32
}

ZipEntry collected zip record fields for file 'pinching'

type ZipFileHeader

type ZipFileHeader struct {
	LocalFileHeaderSignature uint32
	VersionNeededToExtract   uint16
	GeneralPurposeBitFlag    uint16
	CompressionMethod        uint16
	FileLastModificationTime uint16
	FileLastModificationDate uint16
	Crc32L                   uint16
	Crc32H                   uint16
	CompressedSizeL          uint16
	CompressedSizeH          uint16
	UncompressedSizeL        uint16
	UncompressedSizeH        uint16
	FileNameLength           uint16
	ExtraFieldLength         uint16
}

ZipFileHeader zip archive file header, see http://en.wikipedia.org/wiki/ZIP_(file_format)#File_headers

func (*ZipFileHeader) CompressedSize

func (f *ZipFileHeader) CompressedSize() uint32

CompressedSize get the compressed size field from its high and low parts

func (*ZipFileHeader) OriginalSize

func (f *ZipFileHeader) OriginalSize() uint32

OriginalSize get the original size field from its high and low parts

func (*ZipFileHeader) StartOffset

func (f *ZipFileHeader) StartOffset() uint32

StartOffset calculate the actual start offset for the file

Jump to

Keyboard shortcuts

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