File: tramp-archive.el.html

Access functions for file archives. This is possible only on machines which have installed the virtual file system for the Gnome Desktop (GVFS). Internally, file archives are mounted via the GVFS
"archive" method.

A file archive is a regular file of kind "/path/to/dir/file.EXT". The extension ".EXT" identifies the type of the file archive. A file inside a file archive, called archive file name, has the name
"/path/to/dir/file.EXT/dir/file".

Most of the magic file name operations are implemented for archive file names, exceptions are all operations which write into a file archive, and process related operations. Therefore, functions like

  (copy-file "/path/to/dir/file.tar/dir/file" "/somewhere/else")

work out of the box. This is also true for file name completion, and for libraries like dired or ediff, which accept archive file names as well.

File archives are identified by the file name extension ".EXT". Since GVFS uses internally the library libarchive(3), all suffixes, which are accepted by this library, work also for archive file names. Accepted suffixes are listed in the constant tramp-archive-suffixes. They are

* ".7z" - 7-Zip archives
* ".apk" - Android package kits
* ".ar" - UNIX archiver formats
* ".cab", ".CAB" - Microsoft Windows cabinets
* ".cpio" - CPIO archives
* ".crate" - Cargo (Rust) packages
* ".deb" - Debian packages
* ".depot" - HP-UX SD depots
* ".epub" - Electronic publications
* ".exe" - Self extracting Microsoft Windows EXE files
* ".iso" - ISO 9660 images
* ".jar" - Java archives
* ".lzh", ".LZH" - Microsoft Windows compressed LHA archives
* ".msu", ".MSU" - Microsoft Windows Update packages
* ".mtree" - BSD mtree format
* ".odb" ".odf" ".odg" ".odp" ".ods" ".odt" - OpenDocument formats
* ".pax" - Posix archives
* ".rar" - RAR archives
* ".rpm" - Red Hat packages
* ".shar" - Shell archives
* ".tar", ".tbz", ".tgz", ".tlz", ".txz" - (Compressed) tape archives
* ".warc" - Web archives
* ".xar" - macOS XAR archives
* ".xpi" - XPInstall Mozilla addons
* ".xps" - Open XML Paper Specification (OpenXPS) documents
* ".zip", ".ZIP" - ZIP archives

File archives could also be compressed, identified by an additional compression suffix. Valid compression suffixes are listed in the constant tramp-archive-compression-suffixes. They are ".bz2",
".gz", ".lrz", ".lz", ".lz4", ".lzma", ".lzo", ".uu", ".xz", ".Z",
and ".zst". A valid archive file name would be
"/path/to/dir/file.tar.gz/dir/file". Even several suffixes in a
row are possible, like "/path/to/dir/file.tar.gz.uu/dir/file".

An archive file name could be a remote file name, as in
"/ftp:anonymous@ftp.gnu.org:/gnu/tramp/tramp-2.3.2.tar.gz/INSTALL".
Since all file operations are mapped internally to GVFS operations, remote file names supported by tramp-gvfs.el perform better, because no local copy of the file archive must be downloaded first. For example, "/sftp:user@host:..." performs better than the similar
"/scp:user@host:...". See the constant
tramp-archive-all-gvfs-methods for a complete list of tramp-gvfs.el supported method names.

If url-handler-mode(var)/url-handler-mode(fun) is enabled, archives could be visited via URLs, like "https://ftp.gnu.org/gnu/tramp/tramp-2.3.2.tar.gz/INSTALL". This allows complex file operations like

  (ediff-directories
   "https://ftp.gnu.org/gnu/tramp/tramp-2.3.1.tar.gz/tramp-2.3.1"
   "https://ftp.gnu.org/gnu/tramp/tramp-2.3.2.tar.gz/tramp-2.3.2" "")

It is even possible to access file archives in file archives, as

  (find-file "https://ftp.debian.org/debian/pool/main/c/coreutils/coreutils_8.28-1_amd64.deb/control.tar.gz/control")

Defined variables (8)

tramp-archive-all-gvfs-methodsList of all methods ‘tramp-gvfs-methods’ offers.
tramp-archive-compression-suffixesList of suffixes which indicate a compressed file.
tramp-archive-enabledNon-nil when file archive support is available.
tramp-archive-file-name-handler-alistAlist of handler functions for file archive method.
tramp-archive-file-name-regexpRegular expression matching archive file names.
tramp-archive-hashHash table for archive local copies.
tramp-archive-methodMethod name for archives in GVFS.
tramp-archive-suffixesList of suffixes which indicate a file archive.

Defined functions (33)

tramp-archive-autoload-file-name-handler(OPERATION &rest ARGS)
tramp-archive-autoload-file-name-regexp()
tramp-archive-cleanup-hash()
tramp-archive-dissect-file-name(NAME)
tramp-archive-file-name-archive(NAME)
tramp-archive-file-name-for-operation(OPERATION &rest ARGS)
tramp-archive-file-name-handler(OPERATION &rest ARGS)
tramp-archive-file-name-localname(NAME)
tramp-archive-file-name-p(NAME)
tramp-archive-gvfs-file-name(NAME)
tramp-archive-gvfs-host(ARCHIVE)
tramp-archive-handle-access-file(FILENAME STRING)
tramp-archive-handle-copy-file(FILENAME NEWNAME &optional OK-IF-ALREADY-EXISTS KEEP-DATE PRESERVE-UID-GID PRESERVE-EXTENDED-ATTRIBUTES)
tramp-archive-handle-directory-file-name(DIRECTORY)
tramp-archive-handle-directory-files(DIRECTORY &optional FULL MATCH NOSORT COUNT)
tramp-archive-handle-dired-uncache(DIR)
tramp-archive-handle-file-attributes(FILENAME &optional ID-FORMAT)
tramp-archive-handle-file-executable-p(FILENAME)
tramp-archive-handle-file-exists-p(FILENAME)
tramp-archive-handle-file-local-copy(FILENAME)
tramp-archive-handle-file-name-all-completions(FILENAME DIRECTORY)
tramp-archive-handle-file-readable-p(FILENAME)
tramp-archive-handle-file-system-info(FILENAME)
tramp-archive-handle-file-truename(FILENAME)
tramp-archive-handle-insert-directory(FILENAME SWITCHES &optional WILDCARD FULL-DIRECTORY-P)
tramp-archive-handle-insert-file-contents(FILENAME &optional VISIT BEG END REPLACE)
tramp-archive-handle-load(FILE &optional NOERROR NOMESSAGE NOSUFFIX MUST-SUFFIX)
tramp-archive-handle-not-implemented(OPERATION &rest ARGS)
tramp-archive-handle-temporary-file-directory()
tramp-archive-run-real-handler(OPERATION ARGS)
tramp-file-name-archive(VEC)
tramp-register-archive-autoload-file-name-handler()
with-parsed-tramp-archive-file-name(FILENAME VAR &rest BODY)

Defined faces (0)