Skip to main content

Retrieve details from a ZIP file

Get a list of the files inside a ZIP or another supported archive, including their names, locations and sizes. You also get the size of the whole archive and the number of files listed.

Application

  • ZIP

Inputs (what you have)

NameDescriptionData TypeRequired?Example
ZIP fileZIP file to retrieve the file information fromFileYes

Outputs (what you get)

NameDescriptionData TypeRequired?Example
ZIP file detailsA list of file details, returned as JSON text; see the fields belowText (Long)No
Zipped file sizeSize of the whole archive in bytes, including headers and other archive informationNumberNo1024
Number of filesNumber of files in the returned list, including files inside foldersNumberNo3

Check which size fields are available​

The two new size fields, uncompressed_size_in_bytes and compressed_size_in_bytes, appear after the updated action is deployed. Check that they are present in your result before using them in your Wrkflow. If they are missing, follow Older size results.

Details for each file​

ZIP file details contains a JSON list, with one entry for each returned file. Folders themselves, unsafe file paths, and files in the archive's top-level __MACOSX/ folder are left out of both this list and Number of files.

FieldJSON typeMeaning
full_pathStringFile location inside the archive, including the name and extension, such as folder/report.csv.
file_nameStringName without the folder or final extension, such as report.
extensionStringFinal extension without the dot, such as csv. An empty string ("") means there is no extension.
directory_pathStringFolder location ending in /, such as folder/. An empty string ("") means the file is at the top level.
mime_typeStringFile type based on its name, such as text/csv. If the type is not recognised, the value is application/octet-stream. The file contents are not checked.
size_in_bytesNumber or nullSame value as uncompressed_size_in_bytes in the updated action.
uncompressed_size_in_bytesNumber or nullSize before compression, as recorded in the archive. An empty file has a size of 0. null means the size is unavailable.
compressed_size_in_bytesNumber or nullSize recorded for this file inside a ZIP archive. For TAR and 7-Zip, this is null because the action does not report a compressed size for each file.

How to read the sizes​

SituationSize before compressionCompressed size
A file with contents in a ZIP archiveSize of its contents in bytesSize recorded in the ZIP archive
An empty file in a ZIP archive0Can be greater than 0; a compressed empty file can still take up space
A file in a TAR or 7-Zip archiveSize recorded in the archivenull

0 is a recorded size; null means no size is available. TAR archives can also contain links and other special entries: their recorded size may be 0 even when the linked file has contents.

The whole archive also contains headers and other information, so adding the compressed file sizes does not give you Zipped file size. For encrypted ZIP files, the recorded compressed size includes encryption data. TAR and 7-Zip can compress files together, so a separate compressed size for each file is not reported.

For example, an empty file in a ZIP archive can return these details. Its contents take up 0 bytes, while its compressed data takes up 2 bytes:

[
{
"full_path": "folder/empty.txt",
"file_name": "empty",
"extension": "txt",
"directory_path": "folder/",
"mime_type": "text/plain",
"size_in_bytes": 0,
"uncompressed_size_in_bytes": 0,
"compressed_size_in_bytes": 2
}
]

Older size results​

Older action versions return size_in_bytes without the two new size fields.

Archive typeWhat size_in_bytes means in older versions
ZIP or 7-ZipSize before compression when that size is not zero. Otherwise, it uses the compressed size, which may be unavailable. An empty file inside a ZIP archive can therefore report 2 instead of 0.
TARSize recorded in the archive before compression.

If you need to identify empty files, confirm that the action has been updated first. In older ZIP or 7-Zip results, size_in_bytes alone is not a reliable empty-file check.

Outcomes

NameDescription
SuccessThis status is selected if the job has successfully completed.

Supported Archive File Types

ZIP-based formats​

These are handled as ZIP archives:

  • .zip
  • .whl
  • .jar
  • .war
  • .ear
  • .apk
  • .epub
  • .docx
  • .xlsx
  • .pptx
  • .ipa
  • .kmz
  • .xpi
  • .odt
  • .ods
  • .odp

7-Zip formats​

  • .7z

TAR-based formats​

These are handled as TAR archives and common compressed variants:

  • .tar
  • .tgz → normalized to .tar.gz
  • .tar.gz
  • .tar.bz2
  • .tar.xz
  • .tbz
  • .tbz2
  • .txz
  • .gz → treated as .tar.gz
  • .bz2 → treated as .tar.bz2
  • .xz → treated as .tar.xz