Options
All
  • Public
  • Public/Protected
  • All
Menu

A typescript implementation of the heatshrink compression library.

Heatshrink is an open-source LZSS based compression library suitable for use in embedded systems since it has a very small and bounded memory footprint. This is an adaptation of the heatshink code to typescript with a slightly more user-fiendly API.

Hierarchy

  • HeatshrinkDecoder

Index

Constructors

constructor

  • new HeatshrinkDecoder(windowBits: number, lookaheadBits: number, inputBufferSize: number): HeatshrinkDecoder

Properties

Private headIndex

headIndex: number = 0

inputBuffer

inputBuffer: Uint8Array

Private lookaheadBits

lookaheadBits: number

outputBuffer

outputBuffer: Uint8Array

Private outputCount

outputCount: number = 0

Private outputIndex

outputIndex: number = 0

outputSize

outputSize: number = 0

Private state

state: HSState = HSState.TAG_BIT

Private windowBits

windowBits: number

Private windowBuffer

windowBuffer: Uint8Array

Methods

Private assureUint8Array

  • assureUint8Array(buffer: Uint8Array | ArrayBuffer): Uint8Array

Private emitByte

  • emitByte(byte: number): void

Private ensureOutputSpace

  • ensureOutputSpace(neededBytes: number): void

getOutput

  • getOutput(): Uint8Array
  • Get all output data and truncate the output buffer.

    Calling this function repeatedly will have the effect of pulling the output in chunks from the HeatshrinkDecoder. It will return all data currently available and remove it from the output buffer so another call to getOutput() will not return duplicate data.

    Returns Uint8Array

    All data currently in the output buffer.

isFinished

  • isFinished(): boolean

poll

  • poll(): void

process

  • process(rawInput: Uint8Array | ArrayBuffer): void
  • Feed data into the heatshrink decoder state machine.

    This function will take the chunk of input data and turn it into as much expanded output as it can. Decoding a stream of data should be done by calling this function repeatedly with chunks of data from the stream.

    You can call isFinished() to check and see if all of the data that you have fed in from previous calls to process() has been successfully decoded.

    Parameters

    • rawInput: Uint8Array | ArrayBuffer

      A chunk of data that has encoded using the heatshrink library. You can push data a little bit at a time and stop at any byte boundary.

    Returns void

Private processBackrefCountLSB

  • processBackrefCountLSB(): HSState

Private processBackrefCountMSB

  • processBackrefCountMSB(): HSState

Private processBackrefIndexLSB

  • processBackrefIndexLSB(): HSState

Private processBackrefIndexMSB

  • processBackrefIndexMSB(): HSState

Private processTag

reset

  • reset(): void

sink

  • sink(input: Uint8Array): number

Private storeByte

  • storeByte(byte: number): void

Private yieldBackref

Private yieldLiteral

Object literals

Private inputState

inputState: object

bitIndex

bitIndex: number = 0

currentByte

currentByte: number = 0

index

index: number = 0

size

size: number = 0

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc