1.0.3 • Published 2 years ago

nv-file-compress v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

nv-file-compress

  • simple wrap of zlib.createBrotliCompress AND zlib.createBrotli Decompress

install

  • npm install nv-file-compress

usage

  const fcom = require("nv-file-compress")

example

sync

     -rw-r--r-- 1 root root 3929 Mar  1 07:41 tst.js

     var syncbr =require("nv-file-compress").sync;

     > syncbr.compress_file_to_file("./tst.js","./tst.js.str.br")
     './tst.js.br'


     -rw-r--r-- 1 root root 3929 Mar  1 07:41 tst.js
     -rw-r--r-- 1 root root  915 Mar  1 07:42 tst.js.str.br



     syncbr.decompress_from_file("./tst.js.str.br")
     /*
     'const fs = require("fs");\n' +
       'const zlib = require("zlib");\n' +
     */

async

    await x.compress_file_to_file("./package-lock.json","tst.json.br")
    -rw-r--r--  1 root root 1070 Mar  1 08:02 tst.json.br


    ////
    await x.decompress_file_to_file("tst.json.br","tst.json")

    -rw-r--r--  1 root root 5559 Mar  1 07:52 package-lock.json
    -rw-r--r--  1 root root 5559 Mar  1 08:04 tst.json

APIS

    {
      type: {
        TYPES: { byte: 0, str: 1, hex: 2, b64: 3, json: 4 },
        get_type_from_fn: [Function: get_type_from_fn]
      },
      cmmn: {
        _s2buf: [Function: _s2buf],
        _hex2buf: [Function: _hex2buf],
        _latin1_to_buf: [Function: _latin1_to_buf],
        _b64_to_buf: [Function: _b64_to_buf],
        _j2buf: [Function: _j2buf],
        _buf2s: [Function: _buf2s],
        _buf2hex: [Function: _buf2hex],
        _buf_to_latin1: [Function: _buf_to_latin1],
        _buf_to_b64: [Function: _buf_to_b64],
        _buf2j: [Function: _buf2j],
        _file2buf: [Function: _file2buf],
        _file2s: [Function: _file2s],
        _file2hex: [Function: _file2hex],
        _file_to_latin1: [Function: _file_to_latin1],
        _file_to_b64: [Function: _file_to_b64],
        _file2j: [Function: _file2j]
      },
      sync: {
        buf2br: [Function: syncBufferWrapper],
        s2br: [Function: s2br],
        hex2br: [Function: hex2br],
        latin1_to_br: [Function: latin1_to_br],
        b64_to_br: [Function: b64_to_br],
        j2br: [Function: j2br],
        file2br: [Function: file2br],
        compress_to_buf: [Function: compress_to_buf],
        compress_to_file: [Function: compress_to_file],
        compress_file_to_file: [Function: compress_file_to_file],
        br2buf: [Function: syncBufferWrapper],
        br2s: [Function: br2s],
        br2hex: [Function: br2hex],
        br_to_latin1: [Function: br_to_latin1],
        br_to_b64: [Function: br_to_b64],
        br2j: [Function: br2j],
        decompress_from_file: [Function: decompress_from_file]
      },
      async: {
        buf2br: [Function: syncBufferWrapper],
        s2br: [Function: s2br],
        hex2br: [Function: hex2br],
        latin1_to_br: [Function: latin1_to_br],
        b64_to_br: [Function: b64_to_br],
        j2br: [Function: j2br],
        file2br: [Function: file2br],
        compress_to_buf: [Function: compress_to_buf],
        compress_to_file: [Function: compress_to_file],
        compress_file_to_file: [Function: compress_file_to_file],
        br2buf: [Function: syncBufferWrapper],
        br2s: [Function: br2s],
        br2hex: [Function: br2hex],
        br_to_latin1: [Function: br_to_latin1],
        br_to_b64: [Function: br_to_b64],
        br2j: [Function: br2j],
        decompress_from_file: [Function: decompress_from_file]
      }
    }

LICENSE

  • ISC