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-methods | List of all methods ‘tramp-gvfs-methods’ offers. |
tramp-archive-compression-suffixes | List of suffixes which indicate a compressed file. |
tramp-archive-enabled | Non-nil when file archive support is available. |
tramp-archive-file-name-handler-alist | Alist of handler functions for file archive method. |
tramp-archive-file-name-regexp | Regular expression matching archive file names. |
tramp-archive-hash | Hash table for archive local copies. |
tramp-archive-method | Method name for archives in GVFS. |
tramp-archive-suffixes | List of suffixes which indicate a file archive. |