Now with Partition Management

    @fstnetwork/cppzst

    2.0.8 • Public • Published

    cppzst version ZSTD/v1.4.8

    Build Status

    Zstd wrapper for Nodejs 14 and above (CommonJS)

    Installation

    $ yarn add @fstnetwork/cppzst

    Usage

    Async

    compress(buffer[, zstdCompressParams], callback)

    const {compress, decompress} = require('cppzst');
    
    await compress(input);

    decompress(buffer[, zstdDecompressParams], callback)

    const {compress, decompress} = require('cppzst');
    
    await decompress(input)

    Sync

    compressSync(buffer[, zstdCompressParams])

    const compressSync = require('cppzst').compressSync;
    
    try {
      var output = compressSync(input);
    } catch(err) {
      // ...
    }

    decompressSync(buffer[, zstdCompressParams])

    const decompressSync = require('cppzst').decompressSync;
    
    try {
      var output = decompressSync(input);
    } catch(err) {
      // ...
    }

    Stream

    compressStream([zstdCompressParams])

    const compressStream = require('cppzst').compressStream;
    const fs = require('fs');
    
    fs.createReadStream('path/to/input')
      .pipe(compressStream())
      .pipe(fs.createWriteStream('path/to/output'));

    decompressStream([zstdCompressParams])

    const decompressStream = require('cppzst').decompressStream;
    const fs = require('fs');
    
    fs.createReadStream('path/to/input')
      .pipe(decompressStream())
      .pipe(fs.createWriteStream('path/to/output'));

    ZSTD Params

    The compress, compressSync and compressStream methods may accept an optional zstdCompressParams object to define compress level and/or dict.

    const zstdCompressParams = {
      level: 5, // default 1
      dict: new Buffer('hello zstd'), // if dict null, left level only.
      dictSize: dict.length  // if dict null, left level only.
    };

    The decompress, decompressSync and decompressStream methods may accept an optional zstdDecompressParams object to define dict.

    const zdtdDecompressParams = {
      dict: new Buffer('hello zstd'),
      dictSize: dict.length
    };

    Tests

    $ npm test

    License

    MIT

    Install

    npm i @fstnetwork/cppzst

    DownloadsWeekly Downloads

    236

    Version

    2.0.8

    License

    AGPL-3.0-or-later

    Unpacked Size

    44.9 MB

    Total Files

    438

    Last publish

    Collaborators

    • lonsilent
    • noelb24