archive
Source: quickjs-archive.c — module exports Archive, ArchiveEntry, ArchiveMatch
Reading and writing archive files (wraps libarchive): tar, zip, cpio, and the
compression filters libarchive supports. An Archive is iterable over its
entries.
Archive
new Archive() // length 1Methods
| Method | Args | Description |
|---|---|---|
open(filename) | 1 | Opens an archive for reading. |
read(buffer) | 1 | Reads archive data from a buffer. |
write(filename) | 1 | Opens an archive for writing. |
next() | 0 | Advances to the next entry; returns an ArchiveEntry. |
skip() | 0 | Skips the current entry's data. |
seek(offset, whence) | 2 | Seeks within the archive. |
extract(flags) | 1 | Extracts the current entry to disk. |
filterBytes(data) | 1 | Runs data through the archive's filters. |
close() | 0 | Closes the archive. |
[Symbol.iterator]() | 0 | Iterates entries. |
Properties
| Property | Kind | Description |
|---|---|---|
errno / error | getter | Last libarchive error code / string. |
format | getter/setter | Archive format. |
compression | getter | Compression method. |
filters | getter | Active filter chain. |
position | getter | Current byte position. |
readHeaderPosition | getter | Header read position. |
hasEncryptedEntries | getter | Whether encrypted entries are present. |
blockSize | getter/setter | I/O block size. |
fileCount | getter | Number of entries. |
Static members
| Member | Args | Kind | Description |
|---|---|---|---|
read(filename) | 1 | function | Opens an archive for reading in one call. |
write(filename) | 1 | function | Opens an archive for writing in one call. |
version | — | getter | libarchive version. |
ArchiveEntry
new ArchiveEntry() // length 1clone() plus read/write metadata accessors: atime, ctime, mtime,
birthtime, dev, devmajor, devminor, rdev, rdevmajor, rdevminor,
filetype, type, fflags, uid, gid, ino, nlink, pathname
(enumerable), uname, gname, mode, perm, size (enumerable), symlink,
hardlink, link, isDataEncrypted, isMetadataEncrypted, isEncrypted.
ArchiveMatch
new ArchiveMatch() // length 1include(pattern) and exclude(pattern) build path-matching filters for
selective extraction.
Export list
Generated by utilities/doc-api.js from the archive dump of utilities/api-surface.sh: 147 members. Edit the text above this block, not the block.
Archive
class, constructible
- static methods:
read(),version(),write() - static values:
EOF = 1,EXTRACT_ACL = 32,EXTRACT_CLEAR_NOCHANGE_FFLAGS = 131072,EXTRACT_FFLAGS = 64,EXTRACT_HFS_COMPRESSION_FORCED = 32768,EXTRACT_MAC_METADATA = 8192,EXTRACT_NO_AUTODIR = 1024,EXTRACT_NO_HFS_COMPRESSION = 16384,EXTRACT_NO_OVERWRITE = 8,EXTRACT_NO_OVERWRITE_NEWER = 2048,EXTRACT_OWNER = 1,EXTRACT_PERM = 2,EXTRACT_SECURE_NOABSOLUTEPATHS = 65536,EXTRACT_SECURE_NODOTDOT = 512,EXTRACT_SECURE_SYMLINKS = 256,EXTRACT_SPARSE = 4096,EXTRACT_TIME = 4,EXTRACT_UNLINK = 16,EXTRACT_XATTR = 128,FAILED = -25,FATAL = -30,FILTER_BZIP2 = 2,FILTER_COMPRESS = 3,FILTER_GRZIP = 12,FILTER_GZIP = 1,FILTER_LRZIP = 10,FILTER_LZ4 = 13,FILTER_LZIP = 9,FILTER_LZMA = 5,FILTER_LZOP = 11,FILTER_NONE = 0,FILTER_PROGRAM = 4,FILTER_RPM = 8,FILTER_UU = 7,FILTER_XZ = 6,FILTER_ZSTD = 14,FORMAT_7ZIP = 917504,FORMAT_AR = 458752,FORMAT_AR_BSD = 458754,FORMAT_AR_GNU = 458753,FORMAT_BASE_MASK = 16711680,FORMAT_CAB = 786432,FORMAT_CPIO = 65536,FORMAT_CPIO_AFIO_LARGE = 65542,FORMAT_CPIO_BIN_BE = 65539,FORMAT_CPIO_BIN_LE = 65538,FORMAT_CPIO_POSIX = 65537,FORMAT_CPIO_SVR4_CRC = 65541,FORMAT_CPIO_SVR4_NOCRC = 65540,FORMAT_EMPTY = 393216,FORMAT_ISO9660 = 262144,FORMAT_ISO9660_ROCKRIDGE = 262145,FORMAT_LHA = 720896,FORMAT_MTREE = 524288,FORMAT_RAR = 851968,FORMAT_RAR_V5 = 1048576,FORMAT_RAW = 589824,FORMAT_SHAR = 131072,FORMAT_SHAR_BASE = 131073,FORMAT_SHAR_DUMP = 131074,FORMAT_TAR = 196608,FORMAT_TAR_GNUTAR = 196612,FORMAT_TAR_PAX_INTERCHANGE = 196610,FORMAT_TAR_PAX_RESTRICTED = 196611,FORMAT_TAR_USTAR = 196609,FORMAT_WARC = 983040,FORMAT_XAR = 655360,FORMAT_ZIP = 327680,OK = 0,READ = 0,READ_FORMAT_CAPS_ENCRYPT_DATA = 1,READ_FORMAT_CAPS_ENCRYPT_METADATA = 2,READ_FORMAT_CAPS_NONE = 0,READ_FORMAT_ENCRYPTION_DONT_KNOW = -1,READ_FORMAT_ENCRYPTION_UNSUPPORTED = -2,RETRY = -10,SEEK_CUR = 1,SEEK_END = 2,SEEK_SET = 0,WARN = -20,WRITE = 1 - methods:
close(),extract(),filterBytes(),next(),open(),read(),seek(),skip(),write(),[Symbol.iterator]() - properties:
READ = 0,WRITE = 1,blockSize (get/set),compression (get),errno (get),error (get),fileCount (get),filters (get),format (get/set),hasEncryptedEntries (get),position (get),readHeaderPosition (get),[Symbol.toStringTag]
ArchiveEntry
class, constructible
- methods:
clone() - properties:
atime (get/set),birthtime (get/set),ctime (get/set),dev (get/set),devmajor (get/set),devminor (get/set),fflags (get/set),filetype (get/set),gid (get/set),gname (get/set),hardlink (get/set),ino (get/set),isDataEncrypted (get/set),isEncrypted (get/set),isMetadataEncrypted (get/set),link (get/set),mode (get/set),mtime (get/set),nlink (get/set),pathname (get/set),perm (get/set),rdev (get/set),rdevmajor (get/set),rdevminor (get/set),size (get/set),symlink (get/set),type (get/set),uid (get/set),uname (get/set),[Symbol.toStringTag]
ArchiveMatch
class, constructible
- methods:
exclude(),include() - properties:
[Symbol.toStringTag]