Sample code for 30+ languages & platforms
Node.js

Transition from Zip.AppendNew to Zip.AddEmpty

Provides instructions for replacing deprecated AppendNew method calls with AddEmpty.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    var zip = new chilkat.Zip();

    // ...
    // ...
    var pathInZip = "example.dat";

    // ------------------------------------------------------------------------
    // The AppendNew method is deprecated:

    // entryObj: ZipEntry
    var entryObj = zip.AppendNew(pathInZip);
    if (zip.LastMethodSuccess == false) {
        console.log(zip.LastErrorText);
        return;
    }

    // ...
    // ...

    // ------------------------------------------------------------------------
    // Do the equivalent using AddEmpty.

    // Indicate the newly appended entry is not a directory entry.
    var isDir = false;

    success = zip.AddEmpty(isDir,pathInZip);
    if (success == false) {
        console.log(zip.LastErrorText);
        return;
    }

    // Do the following if you need the zip entry object for what was just appended.
    // The newly appended entry is the last one.
    var ze = new chilkat.ZipEntry();
    var index = zip.NumEntries - 1;
    zip.EntryAt(index,ze);

}

chilkatExample();