Method Filesystem.Tar._Tar()->extract()
- Method
extract
voidextract(stringsrc_dir,stringdest_dir,void|string|function(string,Filesystem.Stat:int|string)filter,void|intflags)- Description
Extracts files from the tar file in sequential order.
- Parameter
src_dir The root directory in the tar file system to extract.
- Parameter
dest_dir The root directory in the real file system that will receive the contents of
src_dir. It is assumed to exist and be writable.- Parameter
filter A filter for the entries under
src_dirto extract. If it's a string then it's taken as a glob pattern which is matched against the path belowsrc_dir. That path always begins with a/. For directory entries it ends with a/too, otherwise not.If it's a function then it's called for every entry under
src_dir, and those where it returns nonzero are extracted. The function receives the path part belowsrc_diras the first argument, which is the same as in the glob case above, and the stat struct as the second. If the function returns a string, it's taken as the path belowdest_dirwhere this entry should be extracted (any missing directories are created automatically).If
filteris zero, then everything belowsrc_diris extracted.- Parameter
flags Bitfield of flags to control the extraction:
Filesystem.Tar.EXTRACT_SKIP_MODEDon't set any permission bits from the tar records.
Filesystem.Tar.EXTRACT_SKIP_EXT_MODEDon't set set-user-ID, set-group-ID, or sticky bits from the tar records.
Filesystem.Tar.EXTRACT_SKIP_MTIMEDon't set mtime from the tar records.
Filesystem.Tar.EXTRACT_CHOWNSet owning user and group from the tar records.
Filesystem.Tar.EXTRACT_ERR_ON_UNKNOWNThrow an error if an entry of an unsupported type is encountered. This is ignored otherwise.
Files and directories are supported on all platforms, and symlinks are supported whereever
symlinkexists. Other record types are currently not supported.- Throws
I/O errors are thrown.