Negating Past Mistakes

    dcjson

    1.0.1 • Public • Published

    dcjson

    dcjson is a lightweight node module to Disassemble and Compress JSON object.

    Installation

    npm install dcjson
    

    Documentation

    Compress

    dcjson.compress(json: Object): Uint8Array

    Example

    const dcjson = require("dcjson");
    const fs = require("fs");
    
    const input = fs.readFileSync(`${__dirname}/test.json`, "utf-8");
    const json = JSON.parse(input);
    
    const output = dcjson.compress(json);
    fs.writeFileSync(`${__dirname}/test_compressed.json.dc`, output);

    Decompress

    dcjson.decompress(buffer: Uint8Array): Object

    Example

    const dcjson = require("dcjson");
    const fs = require("fs");
    
    const input = fs.readFileSync(`${__dirname}/test_compressed.json.dc`);
    
    const output = dcjson.decompress(input);
    const json = JSON.stringify(output, null, "\t");
    fs.writeFileSync(`${__dirname}/test_decompressed.json`, json);

    Performance

    Tested 10 times using JSON file of large scale.(712.14KB

    Library Compress Decompress
    dcjson 5.803s / 121.9KB 0.048s
    msgpack 0.042s / 304.3KB 0.050s
    LZ4 0.013s / 99.31KB 0.017s
    - - -
    dcjson + LZ4 70.32KB -
    dcjson + msgpack 83.66KB -

    Changelogs

    v1.0.1

    • Fixed an issue that could encode arrays wrongly.

    v1.0.0

    • Release

    Install

    npm i dcjson

    DownloadsWeekly Downloads

    4

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    568 kB

    Total Files

    9

    Last publish

    Collaborators

    • ponyodesu