React Native Requires Chilkat v11.0.0+
React Native
List Files in a .zip
See more Zip Examples
How to list files within a .zipChilkat React Native Downloads
import { Zip, ZipEntry } from '@chilkat/react-native'
async function chilkatExample() {
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
const zip = new Zip();
try {
await zip.openZipAsync('a.zip');
} catch {
console.log(zip.lastErrorText);
return;
}
// Get the number of files and directories in the .zip
const n = zip.numEntries;
const entry = new ZipEntry();
let i = 0;
while (i < n) {
zip.entryAt(i, entry);
if (!entry.isDirectory) {
// (the filename may include a path)
console.log(entry.fileName);
}
i++;
}
}