Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🔧 Arithmetic coding algorithm implemented in Node.js, both API and CLI support. 算术编码 npm 包,支持 API 调用和 CLI。

License

NotificationsYou must be signed in to change notification settings

upupming/arithmetic-coding

Repository files navigation

npmJavaScript Style GuideCoverallstravis build statusLicense

Installation

Install as module for API usage:

npmiarithmetic-coding

Or install as global CLI:

npmi-garithmetic-coding

API

From file path:

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

FromBuffer:

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

Command-line interface

$ari-coding-hUsage:index[options][command]Options:-v,--versionoutputtheversionnumber-h,--helpoutputusageinformationCommands:encode|e[options]<file>encodeafiledecode|d[options]<file>decodeafile$ari-codingencode-hUsage:encode|e[options]<file>encodeafileOptions:-o,--output<file>outputfilepath-h,--helpoutputusageinformation

Performance

You can see the latesttravis 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

About

🔧 Arithmetic coding algorithm implemented in Node.js, both API and CLI support. 算术编码 npm 包,支持 API 调用和 CLI。

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp