Node.js
Node.js
List Files in a .zip
See more Zip Examples
How to list files within a .zipChilkat Node.js Downloads
NODEJS_PRELUDE
function chilkatExample() {
var success = false;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
var zip = new chilkat.Zip();
success = zip.OpenZip("a.zip");
if (success == false) {
console.log(zip.LastErrorText);
return;
}
// Get the number of files and directories in the .zip
var n = zip.NumEntries;
var entry = new chilkat.ZipEntry();
var i = 0;
while (i < n) {
zip.EntryAt(i,entry);
if (entry.IsDirectory == false) {
// (the filename may include a path)
console.log(entry.FileName);
}
i = i+1;
}
}
chilkatExample();