implode-decoder

1.0.2 • Public • Published

implode-decoder

A pure JavaScript decoder for the PKWare implode compression algorithm.

Build Status NPM

NPM

Note that this is not the same implode algorithm as used in PKZip (compression method 6), but rather a standalone one that was often used in 90s-era games (e.g. StarCraft, Diablo). I believe these algorithms are similar, but at the very least the header formats differ.

Implementation is inspired by StormLib's explode.c.

Usage

The only exported function in this module is a function to create a streams2 Transform stream. You may use the resulting stream as you would any other Transform stream.

var decodeImplode = require('implode-decoder')
  , fs = require('fs')

fs.createReadStream('myFile.example')
  .pipe(decodeImplode())
  .pipe(fs.createWriteStream('decompressed'))

Performance

A simple performance test of a "large" imploded file is included in the perf/ directory. I've run this test alongside an analagous test written in C using StormLib, with the following results:

StormLib: median: 4.468634 ms

implode-decoder: median: 4.314142 ms

Performance characteristics should be relatively similar to StormLib's implementation, although this version supports fully streaming data input, so is a bit more flexible (StormLib's operates on a "pull"-type interface, and expects to have access to data when it needs it).

LICENSE

MIT

Readme

Keywords

Package Sidebar

Install

npm i implode-decoder

Weekly Downloads

14

Version

1.0.2

License

MIT

Unpacked Size

114 kB

Total Files

21

Last publish

Collaborators

  • tec27