Skip to content

Commit

Permalink
Merge pull request #136 from KingMario/master
Browse files Browse the repository at this point in the history
A test function is added
  • Loading branch information
cthackers committed Nov 22, 2017
2 parents 23e3a3d + c6a1efc commit 365d1f4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions adm-zip.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,31 @@ module.exports = function(/*String*/input) {
return true;
},

/**
* Test the archive
*
*/
test : function() {
if (!_zip) {
return false;
}

for(var entry in _zip.entries) {
try{
if (entry.isDirectory) {
continue;
}
var content = _zip.entries[entry].getData();
if (!content) {
return false;
}
} catch (err) {
return false;
}
}
return true;
},

/**
* Extracts the entire archive to the given location
*
Expand Down

0 comments on commit 365d1f4

Please sign in to comment.