Documentation ¶
Index ¶
- Constants
- Variables
- func Parse(extra []byte) (map[uint16]ExtraField, error)
- type Buffer
- func (p *Buffer) Available() int
- func (p *Buffer) Bytes() []byte
- func (p *Buffer) Read16() (n uint16)
- func (p *Buffer) Read32() (n uint32)
- func (p *Buffer) Read8() (n uint8)
- func (p *Buffer) ReadBytes(size int) (b []byte)
- func (p *Buffer) Skip(n int)
- func (p *Buffer) Write16(n uint16)
- func (p *Buffer) Write32(n uint32)
- func (p *Buffer) Write8(n uint8)
- func (p *Buffer) WriteByte(b byte)
- func (p *Buffer) WriteBytes(b []byte)
- func (p *Buffer) WriteHeader(id uint16) func()
- type ExtendedTimestamp
- type ExtraField
- type InfoZIPNewUnix
- type InfoZIPUnicodeComment
- type NTFS
- type NTFSAttribute
- type NTFSRawAttribute
- type NTFSTimeAttribute
Constants ¶
const ExtraFieldExtTime uint16 = 0x5455
ExtraFieldExtTime is the Extended Timestamp Extra Field identifier.
const ExtraFieldNTFS uint16 = 0x000a
NTFS Extra Field identifier
const ExtraFieldUCom uint16 = 0x6375
ExtraFieldUCom is the Info-ZIP's Unicode Comment Extra Field identifier.
const ExtraFieldUnixN uint16 = 0x7875
ExtraFieldUnixN is the Info-ZIP's New Unix (3rd generation) Extra Field identifier.
Variables ¶
var ErrInvalidExtraFieldFormat = errors.New("invalid extra field format")
ErrInvalidExtraFieldFormat is returned when the extra field's format is incorrect.
Functions ¶
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer provides primitive read/write functions for extra fields.
func (*Buffer) WriteHeader ¶
WriteHeader writes a standard Zip Extra Field header, consisting of a uint16 identifier, and uint16 size.
type ExtendedTimestamp ¶
ExtendedTime is the Extended Timestamp Extra Field structure for holding a file entry's last modification time.
func NewExtendedTimestamp ¶
func NewExtendedTimestamp(modTime time.Time) ExtendedTimestamp
NewExtendedTimestamp returns a new ExtendedTime extra field structure.
func (ExtendedTimestamp) Encode ¶
func (field ExtendedTimestamp) Encode() []byte
Encode encodes the ExtendedTimestamp extra field.
type ExtraField ¶
type ExtraField []byte
ExtraField is a ZIP Extra Field byte slice.
func (ExtraField) ExtendedTimestamp ¶
func (ef ExtraField) ExtendedTimestamp() (field ExtendedTimestamp, err error)
ExtendedTime returns the decoded ExtendedTime extra field.
func (ExtraField) InfoZIPNewUnix ¶
func (ef ExtraField) InfoZIPNewUnix() (field InfoZIPNewUnix, err error)
InfoZIPNewUnix returns the decoded InfoZIPNewUnix extra field.
func (ExtraField) InfoZIPUnicodeComment ¶
func (ef ExtraField) InfoZIPUnicodeComment() (field InfoZIPUnicodeComment, err error)
InfoZIPUnicodeComment returns the decoded InfoZIPUnicodeComment extra field.
func (ExtraField) NTFS ¶
func (ef ExtraField) NTFS() (field NTFS, err error)
NTFS returns the decoded NTFS extra field.
type InfoZIPNewUnix ¶
InfoZIPNewUnix is the New Unix Extra Field structure for holding UID and GID file ownership data.
func NewInfoZIPNewUnix ¶
func NewInfoZIPNewUnix(uid *big.Int, gid *big.Int) InfoZIPNewUnix
NewInfoZIPNewUnix returns a new InfoZIPNewUnix extra field structure.
func (InfoZIPNewUnix) Encode ¶
func (field InfoZIPNewUnix) Encode() []byte
Encode encodes the InfoZIPNewUnix extra field.
type InfoZIPUnicodeComment ¶
InfoZIPUnicodeComment is the Unicode Comment Extra Field structure for holding NTFS file comments.
func NewInfoZIPUnicodeComment ¶
func NewInfoZIPUnicodeComment(comment string) InfoZIPUnicodeComment
NewInfoZIPUnicodeComment returns a new InfoZIPUnicodeComment extra field structure.
func (InfoZIPUnicodeComment) Encode ¶
func (field InfoZIPUnicodeComment) Encode() []byte
Encode encodes the InfoZIPUnicodeComment extra field.
type NTFS ¶
type NTFS struct {
Attributes []NTFSAttribute
}
NTFS is the NTFS Extra Field structure for holding NTFS attributes.
func NewNTFS ¶
func NewNTFS(attributes ...NTFSAttribute) NTFS
NewNTFS returns a new NTFS extra field structure.
type NTFSAttribute ¶
NTFSAttribute is an NTFS attribute interface. Each attribute consists of a tag and data. The tag is an identifier for the type of data.
type NTFSRawAttribute ¶
NTFSRawAttribute represents an unrecognized NTFS attribute.
func (NTFSRawAttribute) Data ¶
func (a NTFSRawAttribute) Data() []byte
Tag returns the unrecognized NTFS attribute's data.
func (NTFSRawAttribute) Tag ¶
func (a NTFSRawAttribute) Tag() uint16
Tag returns the unrecognized NTFS attribute's tag.
type NTFSTimeAttribute ¶
NTFSTimeAttribute is an NTFS attribute for storing modified, access and creation file times.
func (NTFSTimeAttribute) Data ¶
func (a NTFSTimeAttribute) Data() []byte
Data returns the NTFS Time attribute's encoded data.
func (NTFSTimeAttribute) Tag ¶
func (a NTFSTimeAttribute) Tag() uint16
Tag returns the NTFS Time attribute's tag. It is always 1.