gzheader.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. 'use strict';
  2. // (C) 1995-2013 Jean-loup Gailly and Mark Adler
  3. // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
  4. //
  5. // This software is provided 'as-is', without any express or implied
  6. // warranty. In no event will the authors be held liable for any damages
  7. // arising from the use of this software.
  8. //
  9. // Permission is granted to anyone to use this software for any purpose,
  10. // including commercial applications, and to alter it and redistribute it
  11. // freely, subject to the following restrictions:
  12. //
  13. // 1. The origin of this software must not be misrepresented; you must not
  14. // claim that you wrote the original software. If you use this software
  15. // in a product, an acknowledgment in the product documentation would be
  16. // appreciated but is not required.
  17. // 2. Altered source versions must be plainly marked as such, and must not be
  18. // misrepresented as being the original software.
  19. // 3. This notice may not be removed or altered from any source distribution.
  20. function GZheader() {
  21. /* true if compressed data believed to be text */
  22. this.text = 0;
  23. /* modification time */
  24. this.time = 0;
  25. /* extra flags (not used when writing a gzip file) */
  26. this.xflags = 0;
  27. /* operating system */
  28. this.os = 0;
  29. /* pointer to extra field or Z_NULL if none */
  30. this.extra = null;
  31. /* extra field length (valid if extra != Z_NULL) */
  32. this.extra_len = 0; // Actually, we don't need it in JS,
  33. // but leave for few code modifications
  34. //
  35. // Setup limits is not necessary because in js we should not preallocate memory
  36. // for inflate use constant limit in 65536 bytes
  37. //
  38. /* space at extra (only when reading header) */
  39. // this.extra_max = 0;
  40. /* pointer to zero-terminated file name or Z_NULL */
  41. this.name = '';
  42. /* space at name (only when reading header) */
  43. // this.name_max = 0;
  44. /* pointer to zero-terminated comment or Z_NULL */
  45. this.comment = '';
  46. /* space at comment (only when reading header) */
  47. // this.comm_max = 0;
  48. /* true if there was or will be a header crc */
  49. this.hcrc = 0;
  50. /* true when done reading gzip header (not used when writing a gzip file) */
  51. this.done = false;
  52. }
  53. module.exports = GZheader;