ArchiveEntry

Common interface to archive entry. Each type implementing ArchiveEntry is either for creation or for extraction, but not both. Entries for archive creation implement ArchiveCreateEntry. Entries for archive extraction implement ArchiveExtractionEntry.

Instances of ArchiveCreateEntry are typically instanciated directly by the user or by thin helpers (e.g. FileArchiveEntry) Instances of ArchiveExtractEntry are instantiated by the extraction algorithm and their final type is hidden.

Members

Functions

isBomb
bool isBomb(ulong allowedSz)

Check if the entry is a potential bomb. A bomb is typically an entry that may overwrite other files outside of the extraction directory. isBomb will return true if the path is an absolute path or a relative path going backwards (containing '..' after normalization). In addition, a criteria of maximum allowed size can be provided (by default all sizes are accepted).

Properties

attributes
uint attributes [@property getter]

The file attributes (as returned std.file.getLinkAttributes)

groupId
int groupId [@property getter]

The group id of the entry

linkname
string linkname [@property getter]

If symlink, this is the path pointed to by the link (relative to the symlink). For directories and regular file, returns null.

mode
EntryMode mode [@property getter]

Tell whether the entry is used for creation (ArchiveCreateEntry) or extraction (ArchiveExtractEntry)

ownerId
int ownerId [@property getter]

The owner id of the entry

path
string path [@property getter]

The archive mode this entry is for. The path of the entry within the archive. Should always be a relative path, and never go backward (..)

size
ulong size [@property getter]

The size of the entry in bytes (returns zero for directories and symlink) This is the size of uncompressed, extracted data.

timeLastModified
SysTime timeLastModified [@property getter]

The timeLastModified of the entry

type
EntryType type [@property getter]

The type of entry (directory, file, symlink)

Meta