Sample code for 30+ languages & platforms
Node.js

Transition from ZipEntry.NextEntry to ZipEntry.GetNext

Provides instructions for replacing deprecated NextEntry method calls with GetNext.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    //  ------------------------------------------------------------------------
    //  The NextEntry method is deprecated.
    //  See below or code showing how to rewrite using EntryAt/GetNext

    var zip = new chilkat.Zip();

    success = zip.OpenZip("qa_data/zips/xml_files.zip");
    if (success !== true) {
        console.log(zip.LastErrorText);
        return;
    }

    // entry: ZipEntry
    var entry = zip.FirstEntry();
    if (zip.LastMethodSuccess == false) {
        console.log("This zip archive is empty.");
        return;
    }

    var finished = false;
    while (finished == false) {

        if (entry.IsDirectory == false) {
            console.log(entry.FileName);
        }
        else {
            console.log("(directory) " + entry.FileName);
        }

        // next: ZipEntry
        var next = entry.NextEntry();
        if (entry.LastMethodSuccess == false) {
            finished = true;
        }

        entry = next;
    }

    zip.CloseZip();

    console.log("----");

    //  ------------------------------------------------------------------------
    //  Do the equivalent using EntryAt/GetNext.

    success = zip.OpenZip("qa_data/zips/xml_files.zip");

    var ze = new chilkat.ZipEntry();
    zip.EntryAt(0,ze);

    var entryValid = true;
    while (entryValid == true) {

        if (ze.IsDirectory == false) {
            console.log(ze.FileName);
        }
        else {
            console.log("(directory) " + ze.FileName);
        }

        entryValid = ze.GetNext();
    }

    zip.CloseZip();

}

chilkatExample();