Below is an example demonstrating how you can list the contents of a zlib compressed (*.zip) file.
// Define an anonymous function; // serves as our main loop, // limits the scope of variables (function(){ // Define the source directory path var sSourcePath = "c:/temp"; // Create a directory object var oDir = new DzDir( sSourcePath ); // Get whether or not the directory exists var bExists = oDir.exists(); // If the directory doesn't exist if( !bExists ){ // Provide feedback print( sSourcePath, "does not exist!" ); // We are done... return; } // Create a zip file object var oZipFile = new DzZipFile( String("%1/DS_Layouts_Backup.zip").arg( sSourcePath ) ); // If the file doesn't exist if( !oZipFile.exists() ){ // Provide feedback print( oZipFile.filePath(), "does not exist!" ); // We are done... return; } // Let the user know we are busy setBusyCursor(); // Open the zip file for reading oZipFile.open( DzZipFile.ReadOnly ); // Retrieve the number of entries in the zip var nNumEntries = oZipFile.getNumEntries(); // Retrieve the names of entries in the zip var aEntries = oZipFile.getFileNames(); // Retrieve the global comment for the zip var sZipComment = oZipFile.getGlobalComment(); // Declare working variables var sFileName; var nIdx; // Start with the first entry oZipFile.goToFirstFile(); // For each entry in the zip do { // Get the current filename sFileName = oZipFile.getCurrentFileName(); // Get the position in the list nIdx = aEntries.indexOf( sFileName ); // If the filename is in the list if( nIdx > -1 ){ // Capture information about the entry aEntries[ nIdx ] = { "name" : sFileName.replace( /\\/g, "/" ), "comment" : oZipFile.getCurrentFileComment(), "attributes" : typeof( oZipFile.getCurrentFileAttributes ) == "function" ? //4.16.1.25 oZipFile.getCurrentFileAttributes() : oZipFile.getCurrentFileAtributes(), "compressed" : oZipFile.getCurrentFileCompressedSize(), "uncompressed" : oZipFile.getCurrentFileUncompressedSize(), "ratio" : oZipFile.getCurrentFileCompressionRatio(), "method" : oZipFile.getCurrentFileCompressionMethod(), "CRC-32" : oZipFile.getCurrentFileCRC(), "folder" : oZipFile.getCurrentFileIsFolder() }; if( typeof( oZipFile.getCurrentFileDateTime ) == "function" ){ //4.16.1.25 aEntries[ nIdx ][ "stamp" ] = oZipFile.getCurrentFileDateTime(); } } } while( oZipFile.goToNextFile() ); // Close the zip file oZipFile.close(); // Let the user know we are done clearBusyCursor(); // Provide feedback print( JSON.stringify( aEntries, null, "\t" ) ); print( sZipComment ); // Finalize the function and invoke })();