Projekt

Obecné

Profil

Stáhnout (1.82 KB) Statistiky
| Větev: | Revize:
1
# HPACK.js
2

    
3
[![Build Status](https://secure.travis-ci.org/indutny/hpack.js.png)](http://travis-ci.org/indutny/hpack.js)
4
[![NPM version](https://badge.fury.io/js/hpack.js.svg)](http://badge.fury.io/js/hpack.js)
5

    
6
Plain-JS implementation of [HPACK][0].
7

    
8
## Usage
9

    
10
```javascript
11
var hpack = require('hpack.js');
12

    
13
var comp = hpack.compressor.create({ table: { size: 256 } });
14
var decomp = hpack.decompressor.create({ table: { size: 256 } });
15

    
16
comp.write([ { name: 'host', value: 'localhost' } ]);
17
var raw = comp.read();
18
console.log(raw);
19
// <Buffer 66 86 a0 e4 1d 13 9d 09>
20

    
21
decomp.write(raw);
22
decomp.execute();
23
console.log(decomp.read());
24
// { name: 'host', value: 'localhost', neverIndex: false }
25
```
26

    
27
#### LICENSE
28

    
29
This software is licensed under the MIT License.
30

    
31
Copyright Fedor Indutny, 2015.
32

    
33
Permission is hereby granted, free of charge, to any person obtaining a
34
copy of this software and associated documentation files (the
35
"Software"), to deal in the Software without restriction, including
36
without limitation the rights to use, copy, modify, merge, publish,
37
distribute, sublicense, and/or sell copies of the Software, and to permit
38
persons to whom the Software is furnished to do so, subject to the
39
following conditions:
40

    
41
The above copyright notice and this permission notice shall be included
42
in all copies or substantial portions of the Software.
43

    
44
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
45
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
46
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
47
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
48
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
49
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
50
USE OR OTHER DEALINGS IN THE SOFTWARE.
51

    
52
[0]: https://tools.ietf.org/html/rfc7541
(3-3/4)