@diablo2/huffman
TypeScript icon, indicating that this package has built-in type declarations

0.9.0 • Public • Published

@diablo2/huffman

Huffman packet encoding for diablo2 network packets

import {Huffman} from '@diablo2/huffman';

/** get total number of bytes needed to decompress  (Including the header)*/
Huffman.getPacketSize([6, 122, 4, 100, 187, 188] ) // 6

/** Get the offset to the first data byte */
Huffman.getHeaderSize([6, 122, 4, 100, 187, 188]) // 1

/** Decompress the buffer and return a new buffer */
Huffman.decompress([6, 122, 4, 100, 187, 188])
/**
[
  1, 0, 4, 8, 48,
  0, 1, 1, 0
]
*/

Readme

Keywords

none

Package Sidebar

Install

npm i @diablo2/huffman

Weekly Downloads

1

Version

0.9.0

License

MIT

Unpacked Size

52.4 kB

Total Files

9

Last publish

Collaborators

  • blacha