Pure JavaScript implementation of the Header Compression format for HTTP/2.
Draft: 12
Please see example.js
.
npm install -S hpack
This option sets the number of bits to read at once by the huffman decoder.
Each level decreases the run time linearly while increasing the static memory usage exponentially.
Valid values are:
1
rss around 350 kB (Reading bit by bit)2
rss around 800 kB (Reading two bits at once)3
rss around 3,7 MB (Reading four bits at once)4
rss around 33,7 MB (Reading eight bits at once)
Changing this will only take effect for new instances of hpack.Decoder
created after the change.
You should only change this at startup. It will read the table synchronously from disk.
The huffman decoding algorithm is based on Fast Prefix Code Processing.
Decoder is a writable stream. You write incoming buffers and it will emit
header
events.
Initial maximum table size. Determine the maximum size that the encoder is using for the dynamic table. In HTTP/2, this value is determined by the SETTINGS_HEADER_TABLE_SIZE setting (see Section 6.5.2 of HTTP2).
See Section 4.2 in the specification for details.
Changes the maximum table size. See maxTableSize
option above for details.
function(name, value, representation) { }
name
: Header field name.value
: Header field value.representation
: How the field was represented. Usefull if you are acting as a intermediary.
See Section 6 in the specification details.
Decoder.REP_INDEXED
: Indexed Header Field Representation.Decoder.REP_INCREMENTAL_INDEXING
: Literal Header Field with Incremental Indexing.Decoder.REP_WITHOUT_INDEXING
: Literal Header Field without Indexing.Decoder.REP_NEVER_INDEXED
: Literal Header Field never Indexed.
MIT