archive

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: BSD-3-Clause-Clear Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TDFManifestFileName = "0.manifest.json"
	TDFPayloadFileName  = "0.payload"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CDFileHeader

type CDFileHeader struct {
	Signature              uint32
	VersionCreated         uint16
	VersionNeeded          uint16
	GeneralPurposeBitFlag  uint16
	CompressionMethod      uint16
	LastModifiedTime       uint16
	LastModifiedDate       uint16
	Crc32                  uint32
	CompressedSize         uint32
	UncompressedSize       uint32
	FilenameLength         uint16
	ExtraFieldLength       uint16
	FileCommentLength      uint16
	DiskNumberStart        uint16
	InternalFileAttributes uint16
	ExternalFileAttributes uint32
	LocalHeaderOffset      uint32
}

type EndOfCDRecord

type EndOfCDRecord struct {
	Signature               uint32
	DiskNumber              uint16
	StartDiskNumber         uint16
	NumberOfCDRecordEntries uint16
	TotalCDRecordEntries    uint16
	SizeOfCentralDirectory  uint32
	CentralDirectoryOffset  uint32
	CommentLength           uint16
}

type FileInfo

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

type LocalFileHeader

type LocalFileHeader struct {
	Signature             uint32
	Version               uint16
	GeneralPurposeBitFlag uint16
	CompressionMethod     uint16
	LastModifiedTime      uint16
	LastModifiedDate      uint16
	Crc32                 uint32
	CompressedSize        uint32
	UncompressedSize      uint32
	FilenameLength        uint16
	ExtraFieldLength      uint16
}

type Reader

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

func NewReader

func NewReader(readSeeker io.ReadSeeker) (Reader, error)

NewReader Create archive reader instance.

func (Reader) ReadAllFileData

func (reader Reader) ReadAllFileData(filename string) ([]byte, error)

ReadAllFileData Return all the data of the file NOTE: Use this method for small file sizes.

func (Reader) ReadFileData

func (reader Reader) ReadFileData(filename string, index int64, length int64) ([]byte, error)

ReadFileData Read data from file of given length of size.

func (Reader) ReadFileSize

func (reader Reader) ReadFileSize(filename string) (int64, error)

ReadFileSize Return the file size of the filename.

type TDFReader

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

func NewTDFReader

func NewTDFReader(readSeeker io.ReadSeeker) (TDFReader, error)

NewTDFReader Create tdf reader instance.

func (TDFReader) Manifest

func (tdfReader TDFReader) Manifest() (string, error)

Manifest Return the manifest of the tdf.

func (TDFReader) PayloadSize

func (tdfReader TDFReader) PayloadSize() (int64, error)

PayloadSize Return the size of the payload.

func (TDFReader) ReadPayload

func (tdfReader TDFReader) ReadPayload(index, length int64) ([]byte, error)

ReadPayload Return the payload of given length from index.

type TDFWriter

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

func NewTDFWriter

func NewTDFWriter(writer io.Writer) *TDFWriter

NewTDFWriter Create tdf writer instance.

func (*TDFWriter) AppendManifest

func (tdfWriter *TDFWriter) AppendManifest(manifest string) error

AppendManifest Add the manifest to tdf archive.

func (*TDFWriter) AppendPayload

func (tdfWriter *TDFWriter) AppendPayload(data []byte) error

AppendPayload Add payload to sdk archive.

func (*TDFWriter) Finish

func (tdfWriter *TDFWriter) Finish() (int64, error)

Finish Finished adding all the files in zip archive.

func (*TDFWriter) SetPayloadSize

func (tdfWriter *TDFWriter) SetPayloadSize(payloadSize int64) error

SetPayloadSize Set 0.payload file size.

type WriteState

type WriteState int
const (
	Initial WriteState = iota
	Appending
	Finished
)

type Writer

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

func NewWriter

func NewWriter(writer io.Writer) *Writer

NewWriter Create tdf3 writer instance.

func (*Writer) AddData

func (writer *Writer) AddData(data []byte) error

AddData Add data to the zip archive.

func (*Writer) AddHeader

func (writer *Writer) AddHeader(filename string, size int64) error

AddHeader set size of the file. calling this method means finished writing the previous file and starting a new file.

func (*Writer) EnableZip64

func (writer *Writer) EnableZip64()

EnableZip64 Enable zip 64.

func (*Writer) Finish

func (writer *Writer) Finish() (int64, error)

Finish Finished adding all the files in zip archive.

func (*Writer) WriteZip64EndOfCentralDirectory

func (writer *Writer) WriteZip64EndOfCentralDirectory() error

WriteZip64EndOfCentralDirectory write the zip64 end of central directory record struct to the archive.

func (*Writer) WriteZip64EndOfCentralDirectoryLocator

func (writer *Writer) WriteZip64EndOfCentralDirectoryLocator() error

WriteZip64EndOfCentralDirectoryLocator write the zip64 end of central directory locator struct to the archive.

type Zip32DataDescriptor

type Zip32DataDescriptor struct {
	Signature        uint32
	Crc32            uint32
	CompressedSize   uint32
	UncompressedSize uint32
}

type Zip64DataDescriptor

type Zip64DataDescriptor struct {
	Signature        uint32
	Crc32            uint32
	CompressedSize   uint64
	UncompressedSize uint64
}

type Zip64EndOfCDRecord

type Zip64EndOfCDRecord struct {
	Signature                          uint32
	RecordSize                         uint64
	VersionMadeBy                      uint16
	VersionToExtract                   uint16
	DiskNumber                         uint32
	StartDiskNumber                    uint32
	NumberOfCDRecordEntries            uint64
	TotalCDRecordEntries               uint64
	CentralDirectorySize               uint64
	StartingDiskCentralDirectoryOffset uint64
}

type Zip64EndOfCDRecordLocator

type Zip64EndOfCDRecordLocator struct {
	Signature         uint32
	CDStartDiskNumber uint32
	CDOffset          uint64
	NumberOfDisks     uint32
}

type Zip64ExtendedInfoExtraField

type Zip64ExtendedInfoExtraField struct {
	Signature             uint16
	Size                  uint16
	OriginalSize          uint64
	CompressedSize        uint64
	LocalFileHeaderOffset uint64
}

type Zip64ExtendedLocalInfoExtraField

type Zip64ExtendedLocalInfoExtraField struct {
	Signature      uint16
	Size           uint16
	OriginalSize   uint64
	CompressedSize uint64
}

type ZipFileEntry

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

Jump to

Keyboard shortcuts

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