JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 160
  • Score
    100M100P100Q92980F
  • License GPL-2.0

Decompress with NRV2E algorithm

Package Exports

  • nrv2e-decompress

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nrv2e-decompress) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

nrv2e-decompress

Build Status Coverage Status npm

Decompress with NRV2E algorithm.

Requirements

This module requires ES6 with Node >= 4.

Installation

npm install nrv2e-decompress

Additionally for Typescript:

npm install -D @types/node

Usage

const nrv2eDecompress = require('nrv2e-decompress')

Typescript:

import nrv2eDecompress from 'nrv2e-decompress'

nrv2eDecompress

nrv2eDecompress(input, output, bufferBits)

Arguments:

  • input is a Buffer with compressed data
  • output is a Buffer from decompressed data and it have to be pre-allocated, ie. with Buffer.alloc method
  • bufferBits is a number of control buffer bits: 8, 16 or 32 (optional: default: 8)

Example:

// Polish vehicle registration certificate scanned from Aztec 2D barcode
const b64Input = 'BgQAANtYAA...'
const binInput = Buffer.from(b64Input, 'base64')

// 4 first bytes in Aztec code are output length
const outputLength = binInput.readUInt32LE(0)
const utf16Output = Buffer.alloc(outputLength)
const compressedInput = binInput.slice(4)

nrv2eDecompress(compressedInput, utf16Output)

const textOutput = utf16Output.toString('utf16le')

License

Copyright (c) 2018 Piotr Roszatycki piotr.roszatycki@gmail.com

This code is based on UCL data compression library:

Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer All Rights Reserved.

GPL-2.0