Sample code for 30+ languages & platforms
Node.js

Decompress Bytes

See more Compression Examples

Demonstrates how to decompress binary data.

Chilkat Node.js Downloads

Node.js
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.

    //  See this example to compress bytes: Compress Bytes

    var fac = new chilkat.FileAccess();

    compressedBytes = fac.ReadEntireFile("qa_data/compressed/compressedBmp.dat");
    if (fac.LastMethodSuccess !== true) {
        console.log(fac.LastErrorText);
        return;
    }

    var compress = new chilkat.Compression();
    compress.Algorithm = "deflate";

    decompressedBytes = compress.DecompressBytes(compressedBytes);
    if (compress.LastMethodSuccess !== true) {
        console.log(compress.LastErrorText);
        return;
    }

    success = fac.WriteEntireFile("qa_output/decompressed.bmp",decompressedBytes);
    if (fac.LastMethodSuccess !== true) {
        console.log(fac.LastErrorText);
        return;
    }


}

chilkatExample();