Starting from Artifactory 4.2.0 new primary Domains were exposed on AQL and can be used when querying for data in Artifactory.
One of the new domains is ‘Archive’.
On the following solution, we will discuss a possible usage of this domain.
Let’s say we want to get a file inside of an archive.
Instead of downloading the entire archive to search for the file, we will first check the archive’s content and if the file is there, we will download it only.
Artifactory provides the ability to browse the content of archived artifacts.
This is enabled by default (This can be changed by editing the mimetypes.xml file which is located under $ARTIFACTORY_HOME/etc/ with the ‘archive’ MIME type).
Assuming that this feature is enabled, the ‘Archive’ domain will be enabled as well.
We will use the following query to get the archive’s content
archive.entries.find(
{
"archive.item.repo":{"$eq":”<repo name>"},
"archive.item.name":{"$eq": "<archive name>"}
}
)
If the file is in the archive, we can use the following REST call to download it from the archive.