Add ability for apk to extract files, extended headers, and metadata directly from .apks
Currently, apk offers no direct way to extract specific contents or metadata from .apks files and the pax headers utilized in the .apk archive format are not easily read with any available tool.
Many scripts need to extract a subset of files from a .apk, and the current method requires either downloading to a temp directory or using apk fetch to stdout pipe repeatedly (which is very wasteful for multiple invocations), verifying with ‘apk verify’, listing with ‘tar -tvf’ piped to sed (using a subshell to generate the expressions) looking for the desired files, capturing which of the desired files are found in the .apk, and finally extracting the found files using ‘tar -xvf’.
Additionally, none of the available tools can read the pax headers in a usable form, reducing one to parsing the raw tar stream with awk to extract the desired headers and metadata, such as checksums.
apk should expose functionality allowing extracting or retrieving all information from each entry as well as accessing archive-level meta-data, and should support basic fnmatch style globbing of entries to be extracted.
(from redmine: issue id 7103, created on 2017-04-08)