Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dex4er/js-nrv2e-decompress
Decompress with NRV2E algorithm
https://github.com/dex4er/js-nrv2e-decompress
hacktoberfest
Last synced: 3 months ago
JSON representation
Decompress with NRV2E algorithm
- Host: GitHub
- URL: https://github.com/dex4er/js-nrv2e-decompress
- Owner: dex4er
- License: other
- Created: 2018-07-28T08:09:18.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-14T08:41:28.000Z (8 months ago)
- Last Synced: 2024-05-14T09:49:07.223Z (8 months ago)
- Topics: hacktoberfest
- Language: TypeScript
- Homepage:
- Size: 47.9 KB
- Stars: 16
- Watchers: 2
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# nrv2e-decompress
[![GitHub](https://img.shields.io/github/v/release/dex4er/js-nrv2e-decompress?display_name=tag&sort=semver)](https://github.com/dex4er/js-nrv2e-decompress)
[![CI](https://github.com/dex4er/js-nrv2e-decompress/actions/workflows/ci.yaml/badge.svg)](https://github.com/dex4er/js-nrv2e-decompress/actions/workflows/ci.yaml)
[![Trunk Check](https://github.com/dex4er/js-nrv2e-decompress/actions/workflows/trunk.yaml/badge.svg)](https://github.com/dex4er/js-nrv2e-decompress/actions/workflows/trunk.yaml)
[![Coverage Status](https://coveralls.io/repos/github/dex4er/js-nrv2e-decompress/badge.svg)](https://coveralls.io/github/dex4er/js-nrv2e-decompress)
[![npm](https://img.shields.io/npm/v/nrv2e-decompress.svg)](https://www.npmjs.com/package/nrv2e-decompress)Decompress with NRV2E algorithm.
## Requirements
This is ESM module which requires ES2020 and Node >= 14.
## Installation
```shell
npm install nrv2e-decompress
```_Additionally for Typescript:_
```shell
npm install -D @types/node
```## Usage
```js
import nrv2eDecompress from "nrv2e-decompress"
```### nrv2eDecompress
```js
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:_
```js
// 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-2024 Piotr Roszatycki
This code is based on UCL data compression library:
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.[GPL-2.0](https://opensource.org/licenses/GPL-2.0)