You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.8 KiB

4 years ago
  1. # HPACK.js
  2. [![Build Status](https://secure.travis-ci.org/indutny/hpack.js.png)](http://travis-ci.org/indutny/hpack.js)
  3. [![NPM version](https://badge.fury.io/js/hpack.js.svg)](http://badge.fury.io/js/hpack.js)
  4. Plain-JS implementation of [HPACK][0].
  5. ## Usage
  6. ```javascript
  7. var hpack = require('hpack.js');
  8. var comp = hpack.compressor.create({ table: { size: 256 } });
  9. var decomp = hpack.decompressor.create({ table: { size: 256 } });
  10. comp.write([ { name: 'host', value: 'localhost' } ]);
  11. var raw = comp.read();
  12. console.log(raw);
  13. // <Buffer 66 86 a0 e4 1d 13 9d 09>
  14. decomp.write(raw);
  15. decomp.execute();
  16. console.log(decomp.read());
  17. // { name: 'host', value: 'localhost', neverIndex: false }
  18. ```
  19. #### LICENSE
  20. This software is licensed under the MIT License.
  21. Copyright Fedor Indutny, 2015.
  22. Permission is hereby granted, free of charge, to any person obtaining a
  23. copy of this software and associated documentation files (the
  24. "Software"), to deal in the Software without restriction, including
  25. without limitation the rights to use, copy, modify, merge, publish,
  26. distribute, sublicense, and/or sell copies of the Software, and to permit
  27. persons to whom the Software is furnished to do so, subject to the
  28. following conditions:
  29. The above copyright notice and this permission notice shall be included
  30. in all copies or substantial portions of the Software.
  31. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  32. OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  33. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  34. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  35. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  36. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  37. USE OR OTHER DEALINGS IN THE SOFTWARE.
  38. [0]: https://tools.ietf.org/html/rfc7541