Documentation ¶
Index ¶
- Constants
- Variables
- func B2S(b []byte) string
- func Envfmt(p string) string
- func MakeDataPath(fpath string) string
- func MakeTagsPath(fpath string) string
- func PathExists(path string) (bool, error)
- func S2B(s string) (b []byte)
- func TempPath(fname string) string
- func ToSlash(s string) string
- func WriteUint(w io.Writer, data Uint, l byte) (err error)
- func WriteUintBuf(b []byte, v Uint)
- type CompleteFS
- type ErrTag
- type FTT
- func (ftt *FTT) Append(wpt, wpf io.WriteSeeker) (err error)
- func (ftt *FTT) Begin(wpt, wpf io.WriteSeeker) (err error)
- func (ftt *FTT) CheckTagset(ts TagsetRaw) (fpath string, err error)
- func (ftt *FTT) DataSize() Uint
- func (ftt *FTT) GetInfo() (TagsetRaw, bool)
- func (ftt *FTT) Init(c int)
- func (ftt *FTT) IsSplitted() bool
- func (ftt *FTT) OpenDir(fulldir string) (fs.ReadDirFile, error)
- func (ftt *FTT) Parse(buf []byte) (n int64, err error)
- func (ftt *FTT) ReadDirN(fulldir string, n int) (list []fs.DirEntry, err error)
- func (ftt *FTT) ReadFTT(r io.ReadSeeker) (err error)
- func (ftt *FTT) ReadFrom(r io.Reader) (n int64, err error)
- func (ftt *FTT) SetInfo(ts TagsetRaw)
- func (ftt *FTT) Sync(wpt, wpf io.WriteSeeker) (err error)
- func (ftt *FTT) WriteTo(w io.Writer) (n int64, err error)
- type FileReader
- type Header
- type PackDirFile
- type PackDirLogger
- type Package
- func (pkg *Package) BaseTagset(offset, size Uint, fpath string) TagsetRaw
- func (pkg *Package) DelTagset(fkey string)
- func (pkg *Package) Enum(f func(string, TagsetRaw) bool)
- func (pkg *Package) FullPath(fpath string) string
- func (pkg *Package) GetDelTagset(fkey string) (TagsetRaw, bool)
- func (pkg *Package) GetTagset(fkey string) (TagsetRaw, bool)
- func (pkg *Package) Glob(pattern string) (res []string, err error)
- func (pkg *Package) HasTagset(fkey string) bool
- func (pkg *Package) Open(dir string) (fs.File, error)
- func (pkg *Package) PackData(w io.WriteSeeker, r io.Reader, fpath string) (ts TagsetRaw, err error)
- func (pkg *Package) PackDir(w io.WriteSeeker, dirname, prefix string, logger PackDirLogger) (err error)
- func (pkg *Package) PackFile(w io.WriteSeeker, file fs.File, fpath string) (ts TagsetRaw, err error)
- func (pkg *Package) PutAlias(oldname, newname string) error
- func (pkg *Package) ReadDir(dir string) ([]fs.DirEntry, error)
- func (pkg *Package) ReadFile(fpath string) ([]byte, error)
- func (pkg *Package) Rename(oldname, newname string) error
- func (pkg *Package) RenameDir(olddir, newdir string, skipexist bool) (count int, err error)
- func (pkg *Package) SetTagset(fkey string, ts TagsetRaw)
- func (pkg *Package) SetupTagset(ts TagsetRaw)
- func (pkg *Package) Stat(fpath string) (fs.FileInfo, error)
- func (pkg *Package) Sub(dir string) (sub fs.FS, err error)
- func (pkg *Package) TrimPath(fpath string) string
- type PkgFile
- type RWMap
- func (rwm *RWMap[K, T]) Delete(key K)
- func (rwm *RWMap[K, T]) Get(key K) (ret T, ok bool)
- func (rwm *RWMap[K, T]) GetAndDelete(key K) (ret T, ok bool)
- func (rwm *RWMap[K, T]) Has(key K) (ok bool)
- func (rwm *RWMap[K, T]) Init(c int)
- func (rwm *RWMap[K, T]) Len() int
- func (rwm *RWMap[K, T]) Range(f func(K, T) bool)
- func (rwm *RWMap[K, T]) Set(key K, val T)
- type TagRaw
- func BoolTag(val bool) TagRaw
- func ByteTag(val byte) TagRaw
- func NumberTag(val float64) TagRaw
- func StrTag(val string) TagRaw
- func TimeTag(val time.Time) TagRaw
- func Uint16Tag(val uint16) TagRaw
- func Uint32Tag(val uint32) TagRaw
- func Uint64Tag(val uint64) TagRaw
- func UintLenTag(val Uint, l byte) TagRaw
- func UintTag(val Uint) TagRaw
- func UnixTag(val time.Time) TagRaw
- func (t TagRaw) TagBool() (bool, bool)
- func (t TagRaw) TagByte() (byte, bool)
- func (t TagRaw) TagNumber() (float64, bool)
- func (t TagRaw) TagStr() (string, bool)
- func (t TagRaw) TagTime() (time.Time, bool)
- func (t TagRaw) TagUint() (ret Uint, ok bool)
- func (t TagRaw) TagUint16() (uint16, bool)
- func (t TagRaw) TagUint32() (uint32, bool)
- func (t TagRaw) TagUint64() (uint64, bool)
- type Tagger
- type TagsetIterator
- func (tsi *TagsetIterator) Del(tid Uint) (TagsetRaw, bool)
- func (tsi *TagsetIterator) Failed() bool
- func (tsi *TagsetIterator) Next() (ok bool)
- func (tsi *TagsetIterator) Passed() bool
- func (tsi *TagsetIterator) Put(tid Uint, tag TagRaw) TagsetRaw
- func (tsi *TagsetIterator) Reset()
- func (tsi *TagsetIterator) Set(tid Uint, tag TagRaw) (TagsetRaw, bool)
- func (tsi *TagsetIterator) TID() Uint
- func (tsi *TagsetIterator) Tag() TagRaw
- func (tsi *TagsetIterator) TagLen() int
- type TagsetRaw
- func (ts TagsetRaw) AccessTime() time.Time
- func (ts TagsetRaw) BirthTime() time.Time
- func (ts TagsetRaw) ChangeTime() time.Time
- func (ts TagsetRaw) Del(tid Uint) (TagsetRaw, bool)
- func (ts TagsetRaw) Get(tid Uint) (TagRaw, bool)
- func (ts TagsetRaw) Has(tid Uint) bool
- func (ts TagsetRaw) HasBirthTime() bool
- func (ts TagsetRaw) HasChangeTime() bool
- func (ts TagsetRaw) Info() (fs.FileInfo, error)
- func (ts TagsetRaw) IsDir() bool
- func (ts TagsetRaw) Iterator() TagsetIterator
- func (ts TagsetRaw) ModTime() time.Time
- func (ts TagsetRaw) Mode() fs.FileMode
- func (ts TagsetRaw) Name() string
- func (ts TagsetRaw) Num() (n int)
- func (ts TagsetRaw) Path() string
- func (ts TagsetRaw) Pos() (offset, size Uint)
- func (ts TagsetRaw) Put(tid Uint, tag TagRaw) TagsetRaw
- func (ts TagsetRaw) Set(tid Uint, tag TagRaw) (TagsetRaw, bool)
- func (ts TagsetRaw) Size() int64
- func (ts TagsetRaw) Sys() interface{}
- func (ts TagsetRaw) TagBool(tid Uint) (bool, bool)
- func (ts TagsetRaw) TagByte(tid Uint) (byte, bool)
- func (ts TagsetRaw) TagNumber(tid Uint) (float64, bool)
- func (ts TagsetRaw) TagStr(tid Uint) (string, bool)
- func (ts TagsetRaw) TagTime(tid Uint) (time.Time, bool)
- func (ts TagsetRaw) TagUint(tid Uint) (Uint, bool)
- func (ts TagsetRaw) TagUint16(tid Uint) (uint16, bool)
- func (ts TagsetRaw) TagUint32(tid Uint) (uint32, bool)
- func (ts TagsetRaw) TagUint64(tid Uint) (uint64, bool)
- func (ts TagsetRaw) Type() fs.FileMode
- type Uint
- type Union
- func (u *Union) AllKeys() (res []string)
- func (u *Union) Close() (err error)
- func (u *Union) Glob(pattern string) (res []string, err error)
- func (u *Union) Open(dir string) (fs.File, error)
- func (u *Union) ReadDir(dir string) ([]fs.DirEntry, error)
- func (u *Union) ReadDirN(dir string, n int) (list []fs.DirEntry, err error)
- func (u *Union) ReadFile(fpath string) ([]byte, error)
- func (u *Union) Stat(fpath string) (fs.FileInfo, error)
- func (u *Union) Sub(dir string) (fs.FS, error)
- type UnionDir
- type Void
- type WriteSeekCloser
Examples ¶
Constants ¶
const ( SignSize = 24 // signature field size. HeaderSize = 64 // package header size in bytes. SignReady = "Whirlwind 3.4 Package " // package is ready for use SignBuild = "Whirlwind 3.4 Prebuild " // package is in building progress )
const ( TIDnone = 0 TIDoffset = 1 // required, uint TIDsize = 2 // required, uint TIDpath = 3 // required, unique, string TIDfid = 4 // unique, uint TIDmtime = 5 // required for files, 8/12 bytes (mod-time) TIDatime = 6 // 8/12 bytes (access-time) TIDctime = 7 // 8/12 bytes (change-time) TIDbtime = 8 // 8/12 bytes (birth-time) TIDattr = 9 // uint32 TIDmime = 10 // string TIDcrc32ieee = 11 // uint32, CRC-32-IEEE 802.3, poly = 0x04C11DB7, init = -1 TIDcrc32c = 12 // uint32, (Castagnoli), poly = 0x1EDC6F41, init = -1 TIDcrc32k = 13 // uint32, (Koopman), poly = 0x741B8CD7, init = -1 TIDcrc64iso = 14 // uint64, poly = 0xD800000000000000, init = -1 TIDmd5 = 20 // [16]byte TIDsha1 = 21 // [20]byte TIDsha224 = 22 // [28]byte TIDsha256 = 23 // [32]byte TIDsha384 = 24 // [48]byte TIDsha512 = 25 // [64]byte TIDtmbjpeg = 100 // []byte, thumbnail image (icon) in JPEG format TIDtmbwebp = 101 // []byte, thumbnail image (icon) in WebP format TIDlabel = 110 // string TIDlink = 111 // string TIDkeywords = 112 // string TIDcategory = 113 // string TIDversion = 114 // string TIDcomment = 116 // string )
List of predefined tags IDs.
const ( PTStidsz = 2 // "tag ID" type size. PTStssize = 2 // "tagset size" type size. )
Package types sizes.
const ( InfoName = "@info" // package info tagset name PackName = "@pack" // package content reference )
Variables ¶
var ( ErrSignPre = errors.New("package is not ready") ErrSignBad = errors.New("signature does not pass") ErrSignFTT = errors.New("header contains incorrect data") ErrRangeTSSize = errors.New("tagset size value is exceeds out of the type dimension") ErrNoTag = errors.New("tag with given ID not found") ErrNoPath = errors.New("file name is absent") ErrNoOffset = errors.New("file offset is absent") ErrOutOff = errors.New("file offset is out of bounds") ErrNoSize = errors.New("file size is absent") ErrOutSize = errors.New("file size is out of bounds") ErrOtherSubdir = errors.New("directory refers to other workspace") )
Errors on WPK-API.
var Normalize = ToSlash
Normalize brings file path to normalized form. Normalized path is the key to FTT map.
Functions ¶
func Envfmt ¶ added in v1.1.0
Envfmt replaces environment variables entries in file path to there values. Environment variables must be enclosed as ${...} in string.
func MakeDataPath ¶ added in v1.3.0
MakeDataPath receives file path and returns it with ".wpf" extension. It hepls to open splitted package.
func MakeTagsPath ¶ added in v1.3.0
MakeTagsPath receives file path and returns it with ".wpt" extension. It hepls to open splitted package.
func PathExists ¶ added in v1.1.0
PathExists check up file or directory existence.
func ToSlash ¶
ToSlash brings filenames to true slashes without superfluous allocations if it possible.
func WriteUint ¶ added in v1.3.2
WriteUint writes to stream given unsigned integer with given size in bytes. Size can be 1, 2, 4, 8.
func WriteUintBuf ¶ added in v1.3.2
WriteUintBuf writes unsigned integer into buffer with predefined size. Size of buffer can be 1, 2, 4, 8.
Types ¶
type CompleteFS ¶ added in v1.4.0
CompleteFS includes all FS interfaces.
type ErrTag ¶
type ErrTag struct { What error // error message Key string // normalized file name TID Uint // tag ID }
ErrTag is error on some field of tags set.
type FTT ¶ added in v1.4.0
type FTT struct {
// contains filtered or unexported fields
}
File tags table.
func (*FTT) Append ¶ added in v1.4.0
func (ftt *FTT) Append(wpt, wpf io.WriteSeeker) (err error)
Append writes prebuild header for previously opened package to append new files.
func (*FTT) Begin ¶ added in v1.4.0
func (ftt *FTT) Begin(wpt, wpf io.WriteSeeker) (err error)
Begin writes prebuild header for new empty package.
func (*FTT) CheckTagset ¶ added in v1.4.1
CheckTagset tests path & offset & size tags existence and checks that size & offset is are in the bounds.
func (*FTT) DataSize ¶ added in v1.4.1
DataSize returns actual package data size from files tags table.
func (*FTT) GetInfo ¶ added in v1.4.4
GetInfo returns package information tagset if it present.
Example ¶
package main import ( "fmt" "log" "strings" "github.com/schwarzlichtbezirk/wpk" ) func main() { var err error // Open package files tags table var pkg *wpk.Package if pkg, err = wpk.OpenPackage("example.wpk"); err != nil { log.Fatal(err) } // How many records in package var m = map[wpk.Uint]wpk.Void{} var n = 0 pkg.Enum(func(fkey string, ts wpk.TagsetRaw) bool { if offset, ok := ts.TagUint(wpk.TIDoffset); ok { m[offset] = wpk.Void{} // count unique offsets } n++ return true }) // Format package information var items = []string{ fmt.Sprintf("files: %d", len(m)), fmt.Sprintf("aliases: %d", n-len(m)), fmt.Sprintf("datasize: %d", pkg.DataSize()), } if ts, ok := pkg.GetInfo(); ok { // get package info if it present if str, ok := ts.TagStr(wpk.TIDlabel); ok { items = append(items, fmt.Sprintf("label: %s", str)) } if str, ok := ts.TagStr(wpk.TIDlink); ok { items = append(items, fmt.Sprintf("link: %s", str)) } } log.Println(strings.Join(items, ", ")) }
Output:
func (*FTT) IsSplitted ¶ added in v1.4.0
IsSplitted returns true if package is splitted on tags and data files.
func (*FTT) OpenDir ¶ added in v1.4.0
func (ftt *FTT) OpenDir(fulldir string) (fs.ReadDirFile, error)
OpenDir returns PackDirFile structure associated with group of files in package pooled with common directory prefix. Usable to implement fs.FileSystem interface.
func (*FTT) ReadDirN ¶ added in v1.4.0
ReadDirN returns fs.DirEntry array with nested into given package directory presentation. It's core function for ReadDirFile and ReadDirFS structures.
func (*FTT) ReadFTT ¶ added in v1.4.0
func (ftt *FTT) ReadFTT(r io.ReadSeeker) (err error)
ReadFTT opens package for reading. At first it checkups file signature, then reads records table, and reads file tagset table. Tags set for each file must contain at least file offset, file size, file ID and file name.
func (*FTT) ReadFrom ¶ added in v1.4.0
ReadFrom reads file tags table whole content from the given stream.
func (*FTT) SetInfo ¶ added in v1.4.0
SetInfo puts given tagset as package information tagset with "@info" path tag.
type FileReader ¶ added in v1.2.0
FileReader is interface for nested package files access.
type Header ¶ added in v1.1.0
type Header struct {
// contains filtered or unexported fields
}
Header - package header.
func (*Header) IsReady ¶ added in v1.3.0
IsReady determines that package is ready for read the data.
type PackDirFile ¶ added in v1.4.0
type PackDirFile struct { TagsetRaw // has fs.FileInfo interface // contains filtered or unexported fields }
PackDirFile is a directory file whose entries can be read with the ReadDir method. fs.ReadDirFile interface implementation.
func (*PackDirFile) Close ¶ added in v1.4.0
func (f *PackDirFile) Close() error
fs.ReadDirFile interface implementation.
func (*PackDirFile) Read ¶ added in v1.4.0
func (f *PackDirFile) Read(b []byte) (n int, err error)
fs.ReadDirFile interface implementation.
type PackDirLogger ¶ added in v1.3.0
type PackDirLogger func(pkg *Package, r io.ReadSeeker, ts TagsetRaw) error
PackDirLogger is function called during PackDir processing after each file with OS file object and inserted tagset, that can be modified.
type Package ¶
Package structure contains file tags table, tagger object to get access to nested files, and subdirectory workspace.
func NewPackage ¶ added in v1.3.2
func NewPackage() *Package
NewPackage returns pointer to new initialized Package filesystem structure. Tagger should be set later if access to nested files is needed.
func OpenPackage ¶ added in v1.4.0
OpenPackage creates Package objects and reads package file tags table from the file with given name. Tagger should be set later if access to nested files is needed.
func (*Package) BaseTagset ¶ added in v1.3.3
BaseTagset returns new tagset based on predefined TID type size and tag size type, and puts file offset and file size into tagset with predefined sizes.
func (*Package) Enum ¶
Enum calls given closure for each tagset in package. Skips package info.
Example ¶
package main import ( "log" "github.com/schwarzlichtbezirk/wpk" ) func main() { var err error // Open package files tags table var pkg *wpk.Package if pkg, err = wpk.OpenPackage("example.wpk"); err != nil { log.Fatal(err) } // How many records in package var n = 0 pkg.Enum(func(fkey string, ts wpk.TagsetRaw) bool { if n < 5 { // print not more than 5 file names from package log.Println(fkey) } n++ return true }) log.Printf("total %d records in package files tags table", n) }
Output:
func (*Package) FullPath ¶ added in v1.4.0
FullPath returns concatenation of workspace and relative path.
func (*Package) GetDelTagset ¶ added in v1.4.0
GetDelTagset deletes the tagset for a key, returning the previous tagset if any.
func (*Package) GetTagset ¶ added in v1.4.4
GetTagset returns tagset with given filename key, if it found.
func (*Package) Glob ¶
Glob returns the names of all files in package matching pattern or nil if there is no matching file. fs.GlobFS interface implementation.
Example ¶
package main import ( "log" "github.com/schwarzlichtbezirk/wpk" ) func main() { var err error // Open package files tags table var pkg *wpk.Package if pkg, err = wpk.OpenPackage("example.wpk"); err != nil { log.Fatal(err) } // Get all JPEG-files in subdirectories var res []string if res, err = pkg.Glob("*/*.jpg"); err != nil { log.Fatal(err) } // and print them for _, fname := range res { log.Println(fname) } }
Output:
func (*Package) HasTagset ¶ added in v1.4.0
HasTagset check up that tagset with given filename key is present.
func (*Package) Open ¶ added in v1.4.0
Open implements access to nested into package file or directory by filename. fs.FS implementation.
func (*Package) PackData ¶ added in v1.3.0
PackData puts data streamed by given reader into package as a file and associate keyname "kpath" with it.
func (*Package) PackDir ¶ added in v1.3.0
func (pkg *Package) PackDir(w io.WriteSeeker, dirname, prefix string, logger PackDirLogger) (err error)
PackDir puts all files of given folder and it's subfolders into package. Logger function can be nil.
func (*Package) PackFile ¶ added in v1.3.0
func (pkg *Package) PackFile(w io.WriteSeeker, file fs.File, fpath string) (ts TagsetRaw, err error)
PackFile puts file with given file handle into package and associate keyname "fpath" with it.
func (*Package) PutAlias ¶ added in v1.3.0
PutAlias makes clone tagset with file name 'oldname' and replace name tag in it to 'newname'. Keeps link to original file name.
func (*Package) ReadDir ¶ added in v1.4.0
ReadDir reads the named directory and returns a list of directory entries sorted by filename. fs.ReadDirFS interface implementation.
func (*Package) ReadFile ¶ added in v1.4.0
ReadFile returns slice with nested into package file content. Makes content copy to prevent ambiguous access to closed mapped memory block. fs.ReadFileFS implementation.
func (*Package) Rename ¶ added in v1.3.0
Rename tagset with file name 'oldname' to 'newname'. Keeps link to original file name.
func (*Package) RenameDir ¶ added in v1.4.3
RenameDir renames all files in package with 'olddir' path to 'newdir' path.
func (*Package) SetupTagset ¶ added in v1.4.4
SetupTagset puts tagset with filename key stored at tagset.
func (*Package) Stat ¶ added in v1.4.0
Stat returns a fs.FileInfo describing the file. fs.StatFS interface implementation.
type PkgFile ¶ added in v1.4.4
type PkgFile interface { fs.File FileReader }
PkgFile is interface for access to nested into package files.
type RWMap ¶ added in v1.4.4
type RWMap[K comparable, T any] struct { // contains filtered or unexported fields }
func (*RWMap[K, T]) GetAndDelete ¶ added in v1.4.4
type TagRaw ¶ added in v1.4.0
type TagRaw []byte
TagRaw - file description item.
func UintLenTag ¶ added in v1.4.0
UintLenTag is unsigned int tag constructor with specified length in bytes.
type TagsetIterator ¶ added in v1.3.0
type TagsetIterator struct { TagsetRaw // contains filtered or unexported fields }
TagsetIterator helps to iterate through all tags.
func (*TagsetIterator) Del ¶ added in v1.3.0
func (tsi *TagsetIterator) Del(tid Uint) (TagsetRaw, bool)
Del is the stub to disable any changes to data content of iterator.
func (*TagsetIterator) Failed ¶ added in v1.3.0
func (tsi *TagsetIterator) Failed() bool
Failed points that iterator is finished by broken tagset state.
func (*TagsetIterator) Next ¶ added in v1.3.0
func (tsi *TagsetIterator) Next() (ok bool)
Next carries to the next tag position.
Example ¶
package main import ( "fmt" "time" "github.com/schwarzlichtbezirk/wpk" ) func main() { var ts = wpk.TagsetRaw{}. Put(wpk.TIDpath, wpk.StrTag("picture.jpg")). Put(wpk.TIDmtime, wpk.TimeTag(time.Now())). Put(wpk.TIDmime, wpk.StrTag("image/jpeg")) var tsi = ts.Iterator() for tsi.Next() { fmt.Printf("tid=%d, len=%d\n", tsi.TID(), tsi.TagLen()) } }
Output: tid=3, len=11 tid=5, len=12 tid=10, len=10
func (*TagsetIterator) Passed ¶ added in v1.3.0
func (tsi *TagsetIterator) Passed() bool
Passed returns true if the end of iterations is successfully reached.
Example ¶
package main import ( "fmt" "github.com/schwarzlichtbezirk/wpk" ) func main() { var slice = []byte{ 3, 0, 4, 0, 10, 0, 0, 0, 4, 0, 12, 0, 115, 111, 109, 101, 102, 105, 108, 101, 46, 100, 97, 116, } var tsi = wpk.TagsetRaw(slice).Iterator() for tsi.Next() { // place some handler code here } fmt.Println(tsi.Passed()) }
Output: true
func (*TagsetIterator) Put ¶ added in v1.3.0
func (tsi *TagsetIterator) Put(tid Uint, tag TagRaw) TagsetRaw
Put is the stub to disable any changes to data content of iterator.
func (*TagsetIterator) Reset ¶ added in v1.3.0
func (tsi *TagsetIterator) Reset()
Reset restarts iterator for new iterations loop.
func (*TagsetIterator) Set ¶ added in v1.3.0
func (tsi *TagsetIterator) Set(tid Uint, tag TagRaw) (TagsetRaw, bool)
Set is the stub to disable any changes to data content of iterator.
func (*TagsetIterator) TID ¶ added in v1.3.0
func (tsi *TagsetIterator) TID() Uint
TID returns the tag ID of the last readed tag.
func (*TagsetIterator) Tag ¶ added in v1.3.0
func (tsi *TagsetIterator) Tag() TagRaw
Tag returns tag slice of the last readed tag content.
func (*TagsetIterator) TagLen ¶ added in v1.3.0
func (tsi *TagsetIterator) TagLen() int
TagLen returns length of last readed tag content.
type TagsetRaw ¶ added in v1.4.0
type TagsetRaw []byte
TagsetRaw is slice of bytes with tags set. Each tag should be with unique ID. fs.FileInfo interface implementation.
func GetPackageInfo ¶ added in v1.3.0
func GetPackageInfo(r io.ReadSeeker) (ts TagsetRaw, err error)
GetPackageInfo returns tagset with package information. It's a quick function to get info from the file.
func (TagsetRaw) AccessTime ¶ added in v1.4.0
AccessTime returns file access timestamp of nested into package file. times.Timespec implementation.
func (TagsetRaw) BirthTime ¶ added in v1.4.0
BirthTime returns file access timestamp of nested into package file. times.Timespec implementation.
func (TagsetRaw) ChangeTime ¶ added in v1.4.0
ChangeTime returns file change timestamp of nested into package file. times.Timespec implementation.
func (TagsetRaw) Get ¶ added in v1.4.0
GetTag returns TagRaw with given identifier. If tag is not found, slice content is broken, returns false.
func (TagsetRaw) HasBirthTime ¶ added in v1.4.0
HasBirthTime is times.Timespec interface implementation. Returns whether birth timestamp is present.
func (TagsetRaw) HasChangeTime ¶ added in v1.4.0
HasChangeTime is times.Timespec interface implementation. Returns whether change timestamp is present.
func (TagsetRaw) Info ¶ added in v1.4.0
Info returns the FileInfo for the file or subdirectory described by the entry. fs.DirEntry interface implementation.
func (TagsetRaw) IsDir ¶ added in v1.4.0
IsDir detects that object presents a directory. Directory can not have file ID. fs.FileInfo implementation.
func (TagsetRaw) Iterator ¶ added in v1.4.0
func (ts TagsetRaw) Iterator() TagsetIterator
Iterator clones this tagset to iterate through all tags.
func (TagsetRaw) ModTime ¶ added in v1.4.0
ModTime returns file modification timestamp of nested into package file. fs.FileInfo & times.Timespec implementation.
func (TagsetRaw) Name ¶ added in v1.4.0
Name returns base name of nested into package file. fs.FileInfo implementation.
func (TagsetRaw) Path ¶ added in v1.4.0
Path returns path of nested into package file. Path required to be present in any tagset.
func (TagsetRaw) Pos ¶ added in v1.4.0
Pos returns file offset and file size in package. Those values required to be present in any tagset.
func (TagsetRaw) Put ¶ added in v1.4.0
Put appends new tag to tagset. Can be used in chain calls at initialization.
func (TagsetRaw) Set ¶ added in v1.4.0
Set replaces tag with given ID and equal size, or appends it to tagset. Returns true if new one added.
func (TagsetRaw) Size ¶ added in v1.4.0
Size returns size of nested into package file. fs.FileInfo implementation.
func (TagsetRaw) Sys ¶ added in v1.4.0
func (ts TagsetRaw) Sys() interface{}
Sys is for fs.FileInfo interface compatibility.
func (TagsetRaw) TagUint16 ¶ added in v1.4.0
TagUint16 is 16-bit unsigned int tag getter. Conversion can be used to get signed 16-bit integers.
func (TagsetRaw) TagUint32 ¶ added in v1.4.0
TagUint32 is 32-bit unsigned int tag getter. Conversion can be used to get signed 32-bit integers.
type Uint ¶ added in v1.4.0
type Uint uint64
Uint can hold unsigned integer of any size on any platform.
func ReadUint ¶ added in v1.3.2
ReadUint reads from stream unsigned integer with given size in bytes. Size can be 1, 2, 4, 8.
func ReadUintBuf ¶ added in v1.3.2
ReadUintBuf reads unsigned integer from buffer of predefined size. Dimension of integer depended from size of buffer, size can be 1, 2, 4, 8.
type Union ¶ added in v1.4.0
type Union struct {
List []*Package
}
Union glues list of packages into single filesystem.
func (*Union) AllKeys ¶ added in v1.4.0
AllKeys returns list of all accessible files in union of packages. If union have more than one file with the same name, only first entry will be included to result.
func (*Union) Close ¶ added in v1.4.0
Close call Close-function for all included into the union packages. io.Closer implementation.
func (*Union) Glob ¶ added in v1.4.0
Glob returns the names of all files in union matching pattern or nil if there is no matching file.
func (*Union) Open ¶ added in v1.4.0
Open implements access to nested into union of packages file or directory by keyname. If union have more than one file with the same name, first will be returned. fs.FS implementation.
func (*Union) ReadDir ¶ added in v1.4.0
ReadDir reads the named directory and returns a list of directory entries sorted by filename. fs.ReadDirFS interface implementation.
func (*Union) ReadDirN ¶ added in v1.4.0
ReadDir reads the named directory and returns a list of directory entries sorted by filename.
func (*Union) ReadFile ¶ added in v1.4.0
ReadFile returns slice with nested into union of packages file content. If union have more than one file with the same name, first will be returned. fs.ReadFileFS implementation.
type UnionDir ¶ added in v1.4.0
UnionDir is helper to get access to union directories, that contains files from all packages with same dir if it present.