Notoriously Punctual Manatee

    @xingrz/cppzst
    TypeScript icon, indicating that this package has built-in type declarations

    2.1.0-alpha.8 • Public • Published

    @xingrz/cppzst test

    license issues stars commits

    Zstd binding for Nodejs, with TypeScript support.

    Installation

    $ npm install @xingrz/cppzst --save

    Usage

    Async

    compress(buffer[, zstdCompressParams])

    import { compress } from '@xingrz/cppzst';
    
    try {
      const output = await compress(input);
    } catch(err) {
      // ...
    }

    decompress(buffer[, zstdDecompressParams])

    import { decompress } from '@xingrz/cppzst';
    
    try {
      const output = await decompress(input);
    } catch(err) {
      // ...
    }

    Sync

    compressSync(buffer[, zstdCompressParams])

    import { compressSync } from '@xingrz/cppzst';
    
    try {
      const output = compressSync(input);
    } catch(err) {
      // ...
    }

    decompressSync(buffer[, zstdCompressParams])

    import { decompressSync } from '@xingrz/cppzst';
    
    try {
      const output = decompressSync(input);
    } catch(err) {
      // ...
    }

    Stream

    compressStream([zstdCompressParams])

    import { compressStream } from '@xingrz/cppzst';
    import { createReadStream, createWriteStream } from 'fs';
    
    createReadStream('path/to/input')
      .pipe(compressStream())
      .pipe(createWriteStream('path/to/output'));

    decompressStream([zstdCompressParams])

    import { decompressStream } from '@xingrz/cppzst';
    import { createReadStream, createWriteStream } from 'fs';
    
    createReadStream('path/to/input')
      .pipe(decompressStream())
      .pipe(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 @xingrz/cppzst

    DownloadsWeekly Downloads

    178

    Version

    2.1.0-alpha.8

    License

    MIT

    Unpacked Size

    19.3 MB

    Total Files

    485

    Last publish

    Collaborators

    • xingrz