Socket
Socket
Sign inDemoInstall

arithmetic-coding

Package Overview
Dependencies
8
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    arithmetic-coding

Arithmetic coding implementation


Version published
Maintainers
1
Install size
2.33 MB
Created

Changelog

Source

v1.2.3

2019.03.31

  • Clean up dependencies.

Readme

Source

arithmetic-coding

npm JavaScript Style Guide Coveralls travis build status License

Installation

Install as module for API usage:

npm i arithmetic-coding

Or install as global CLI:

npm i -g arithmetic-coding

API

From file path:

const ariCoding = require('arithmetic-coding');
// Encode from file
ariCoding.encode(path.resolve('/txt/long.txt'), path.resolve('/txt/long-encoded.txt'));
// Decode from file
ariCoding.decode(path.resolve('/txt/long-encoded.txt'), path.resolve('/txt/long-decoded.txt'));

From Buffer:

let data = Buffer.from('Example data', 'utf8');
// Encode from Buffer
let encoded = encode.encodeFromBuffer(data);
console.log(`encoded = ${encoded}`);
// Decode from Buffer
let decoded = decode.decodeFromBuffer(encoded);
console.log(`decoded = ${decoded}`);

Command-line interface

$ ari-coding -h
Usage: index [options] [command]

Options:
  -v, --version              output the version number
  -h, --help                 output usage information

Commands:
  encode|e [options] <file>  encode a file
  decode|d [options] <file>  decode a file

$ ari-coding encode -h
Usage: encode|e [options] <file>

encode a file

Options:
  -o, --output <file>  output file path
  -h, --help           output usage information

Performance

You can see the latest travis test for running time used by each test.

Some benchmarks are shown below:

File size (Bytes)total timeencode timedecode time
60640110mssmall110ms
21306402940ms426ms2514ms

About the algorithm

  1. Wikipedia
  2. How to implement practical encoder/decoder
  3. Reference-arithmetic-coding on GitHub

Keywords

FAQs

Last updated on 31 Mar 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc