@gmod/cram 5.0.2 → 5.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,26 @@
1
+ export default class CRC32 {
2
+ /**
3
+ * The current CRC
4
+ * @private
5
+ */
6
+ private crc;
7
+ /**
8
+ * Constructor initializes the CRC value
9
+ */
10
+ constructor();
11
+ /**
12
+ * @return The current CRC
13
+ */
14
+ getCRC(): number;
15
+ /**
16
+ * Update the CRC with a single byte
17
+ * @param value The value to update the CRC with
18
+ */
19
+ updateCRC(value: number): void;
20
+ /**
21
+ * Update the CRC with a sequence of identical bytes
22
+ * @param value The value to update the CRC with
23
+ * @param count The number of bytes
24
+ */
25
+ updateCRCRun(value: number, count: number): void;
26
+ }
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // @ts-nocheck
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  /* CRC32, used in Bzip2 implementation.
4
4
  * This is a port of CRC32.java from the jbzip2 implementation at
5
5
  * https://code.google.com/p/jbzip2
@@ -30,84 +30,86 @@
30
30
  * Copyright (c) 2013 C. Scott Ananian
31
31
  * with the same licensing terms as Matthew Francis' original implementation.
32
32
  */
33
- module.exports = (function () {
33
+ /**
34
+ * A static CRC lookup table
35
+ */
36
+ const crc32Lookup = new Uint32Array([
37
+ 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
38
+ 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
39
+ 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
40
+ 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
41
+ 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3,
42
+ 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
43
+ 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef,
44
+ 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
45
+ 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb,
46
+ 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
47
+ 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0,
48
+ 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
49
+ 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4,
50
+ 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
51
+ 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08,
52
+ 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
53
+ 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc,
54
+ 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
55
+ 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050,
56
+ 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
57
+ 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34,
58
+ 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
59
+ 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1,
60
+ 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
61
+ 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5,
62
+ 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
63
+ 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9,
64
+ 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
65
+ 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd,
66
+ 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
67
+ 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71,
68
+ 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
69
+ 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2,
70
+ 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
71
+ 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e,
72
+ 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
73
+ 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a,
74
+ 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
75
+ 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676,
76
+ 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
77
+ 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662,
78
+ 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
79
+ 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4,
80
+ ]);
81
+ class CRC32 {
82
+ /**
83
+ * Constructor initializes the CRC value
84
+ */
85
+ constructor() {
86
+ this.crc = 0xffffffff;
87
+ }
88
+ /**
89
+ * @return The current CRC
90
+ */
91
+ getCRC() {
92
+ return ~this.crc >>> 0; // return an unsigned value
93
+ }
94
+ /**
95
+ * Update the CRC with a single byte
96
+ * @param value The value to update the CRC with
97
+ */
98
+ updateCRC(value) {
99
+ this.crc =
100
+ (this.crc << 8) ^ crc32Lookup[((this.crc >>> 24) ^ value) & 0xff];
101
+ }
34
102
  /**
35
- * A static CRC lookup table
103
+ * Update the CRC with a sequence of identical bytes
104
+ * @param value The value to update the CRC with
105
+ * @param count The number of bytes
36
106
  */
37
- const crc32Lookup = new Uint32Array([
38
- 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
39
- 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
40
- 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
41
- 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
42
- 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3,
43
- 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
44
- 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef,
45
- 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
46
- 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb,
47
- 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
48
- 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0,
49
- 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
50
- 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4,
51
- 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
52
- 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08,
53
- 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
54
- 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc,
55
- 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
56
- 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050,
57
- 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
58
- 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34,
59
- 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
60
- 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1,
61
- 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
62
- 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5,
63
- 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
64
- 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9,
65
- 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
66
- 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd,
67
- 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
68
- 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71,
69
- 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
70
- 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2,
71
- 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
72
- 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e,
73
- 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
74
- 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a,
75
- 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
76
- 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676,
77
- 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
78
- 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662,
79
- 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
80
- 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4,
81
- ]);
82
- const CRC32 = function () {
83
- /**
84
- * The current CRC
85
- */
86
- let crc = 0xffffffff;
87
- /**
88
- * @return The current CRC
89
- */
90
- this.getCRC = function () {
91
- return ~crc >>> 0; // return an unsigned value
92
- };
93
- /**
94
- * Update the CRC with a single byte
95
- * @param value The value to update the CRC with
96
- */
97
- this.updateCRC = function (value) {
98
- crc = (crc << 8) ^ crc32Lookup[((crc >>> 24) ^ value) & 0xff];
99
- };
100
- /**
101
- * Update the CRC with a sequence of identical bytes
102
- * @param value The value to update the CRC with
103
- * @param count The number of bytes
104
- */
105
- this.updateCRCRun = function (value, count) {
106
- while (count-- > 0) {
107
- crc = (crc << 8) ^ crc32Lookup[((crc >>> 24) ^ value) & 0xff];
108
- }
109
- };
110
- };
111
- return CRC32;
112
- })();
107
+ updateCRCRun(value, count) {
108
+ while (count-- > 0) {
109
+ this.crc =
110
+ (this.crc << 8) ^ crc32Lookup[((this.crc >>> 24) ^ value) & 0xff];
111
+ }
112
+ }
113
+ }
114
+ exports.default = CRC32;
113
115
  //# sourceMappingURL=crc32.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"crc32.js","sourceRoot":"","sources":["../../src/seek-bzip/crc32.ts"],"names":[],"mappings":";AAAA,cAAc;AAEd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,OAAO,GAAG,CAAC;IAChB;;OAEG;IACH,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC;QAClC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAA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GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI,CAAE,CAAA;IACtE,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,KAAa,EAAE,KAAa;QACvC,OAAO,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;YACnB,IAAI,CAAC,GAAG;gBACN,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI,CAAE,CAAA;QACtE,CAAC;IACH,CAAC;CACF;AAzCD,wBAyCC"}
@@ -1 +1,8 @@
1
- declare const Stream: () => void;
1
+ export default class Stream {
2
+ readByte(): void;
3
+ read(buffer: any, bufOffset: any, length: any): number;
4
+ writeByte(_byte: any): void;
5
+ seek(new_pos: any): void;
6
+ write(buffer: any, bufOffset: any, length: any): any;
7
+ flush(): void;
8
+ }
@@ -1,41 +1,37 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  // @ts-nocheck
3
- /// * very simple input/output stream interface */
4
- const Stream = function () { };
5
- // input streams //////////////
6
- /** Returns the next byte, or -1 for EOF. */
7
- Stream.prototype.readByte = function () {
8
- throw new Error('abstract method readByte() not implemented');
9
- };
10
- /** Attempts to fill the buffer; returns number of bytes read, or
11
- * -1 for EOF. */
12
- Stream.prototype.read = function (buffer, bufOffset, length) {
13
- let bytesRead = 0;
14
- while (bytesRead < length) {
15
- const c = this.readByte();
16
- if (c < 0) {
17
- // EOF
18
- return bytesRead === 0 ? -1 : bytesRead;
4
+ class Stream {
5
+ readByte() {
6
+ throw new Error('abstract method readByte() not implemented');
7
+ }
8
+ read(buffer, bufOffset, length) {
9
+ let bytesRead = 0;
10
+ while (bytesRead < length) {
11
+ const c = this.readByte();
12
+ if (c < 0) {
13
+ // EOF
14
+ return bytesRead === 0 ? -1 : bytesRead;
15
+ }
16
+ buffer[bufOffset++] = c;
17
+ bytesRead++;
19
18
  }
20
- buffer[bufOffset++] = c;
21
- bytesRead++;
19
+ return bytesRead;
20
+ }
21
+ writeByte(_byte) {
22
+ throw new Error('abstract method readByte() not implemented');
22
23
  }
23
- return bytesRead;
24
- };
25
- Stream.prototype.seek = function (new_pos) {
26
- throw new Error('abstract method seek() not implemented');
27
- };
28
- // output streams ///////////
29
- Stream.prototype.writeByte = function (_byte) {
30
- throw new Error('abstract method readByte() not implemented');
31
- };
32
- Stream.prototype.write = function (buffer, bufOffset, length) {
33
- let i;
34
- for (i = 0; i < length; i++) {
35
- this.writeByte(buffer[bufOffset++]);
24
+ seek(new_pos) {
25
+ throw new Error('abstract method seek() not implemented');
26
+ }
27
+ write(buffer, bufOffset, length) {
28
+ let i;
29
+ for (i = 0; i < length; i++) {
30
+ this.writeByte(buffer[bufOffset++]);
31
+ }
32
+ return length;
36
33
  }
37
- return length;
38
- };
39
- Stream.prototype.flush = function () { };
40
- module.exports = Stream;
34
+ flush() { }
35
+ }
36
+ exports.default = Stream;
41
37
  //# sourceMappingURL=stream.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/seek-bzip/stream.ts"],"names":[],"mappings":";AAAA,cAAc;AACd,kDAAkD;AAClD,MAAM,MAAM,GAAG,cAAa,CAAC,CAAA;AAE7B,+BAA+B;AAC/B,4CAA4C;AAC5C,MAAM,CAAC,SAAS,CAAC,QAAQ,GAAG;IAC1B,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;AAC/D,CAAC,CAAA;AACD;kBACkB;AAClB,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,UAAU,MAAM,EAAE,SAAS,EAAE,MAAM;IACzD,IAAI,SAAS,GAAG,CAAC,CAAA;IACjB,OAAO,SAAS,GAAG,MAAM,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,CAA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,OAAO,SAAS,GAAG,MAAM,EAAE,CAAC;YAC1B,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAA;YACzB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBACV,MAAM;gBACN,OAAO,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;YACzC,CAAC;YACD,MAAM,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,CAAA;YACvB,SAAS,EAAE,CAAA;QACb,CAAC;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,SAAS,CAAC,KAAK;QACb,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;IAC/D,CAAC;IACD,IAAI,CAAC,OAAO;QACV,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;IAC3D,CAAC;IACD,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM;QAC7B,IAAI,CAAC,CAAA;QACL,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;QACrC,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IACD,KAAK,KAAI,CAAC;CACX;AA/BD,yBA+BC"}
@@ -0,0 +1,26 @@
1
+ export default class CRC32 {
2
+ /**
3
+ * The current CRC
4
+ * @private
5
+ */
6
+ private crc;
7
+ /**
8
+ * Constructor initializes the CRC value
9
+ */
10
+ constructor();
11
+ /**
12
+ * @return The current CRC
13
+ */
14
+ getCRC(): number;
15
+ /**
16
+ * Update the CRC with a single byte
17
+ * @param value The value to update the CRC with
18
+ */
19
+ updateCRC(value: number): void;
20
+ /**
21
+ * Update the CRC with a sequence of identical bytes
22
+ * @param value The value to update the CRC with
23
+ * @param count The number of bytes
24
+ */
25
+ updateCRCRun(value: number, count: number): void;
26
+ }
@@ -1,5 +1,3 @@
1
- "use strict";
2
- // @ts-nocheck
3
1
  /* CRC32, used in Bzip2 implementation.
4
2
  * This is a port of CRC32.java from the jbzip2 implementation at
5
3
  * https://code.google.com/p/jbzip2
@@ -30,84 +28,85 @@
30
28
  * Copyright (c) 2013 C. Scott Ananian
31
29
  * with the same licensing terms as Matthew Francis' original implementation.
32
30
  */
33
- module.exports = (function () {
31
+ /**
32
+ * A static CRC lookup table
33
+ */
34
+ const crc32Lookup = new Uint32Array([
35
+ 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
36
+ 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
37
+ 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
38
+ 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
39
+ 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3,
40
+ 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
41
+ 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef,
42
+ 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
43
+ 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb,
44
+ 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
45
+ 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0,
46
+ 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
47
+ 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4,
48
+ 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
49
+ 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08,
50
+ 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
51
+ 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc,
52
+ 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
53
+ 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050,
54
+ 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
55
+ 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34,
56
+ 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
57
+ 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1,
58
+ 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
59
+ 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5,
60
+ 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
61
+ 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9,
62
+ 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
63
+ 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd,
64
+ 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
65
+ 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71,
66
+ 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
67
+ 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2,
68
+ 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
69
+ 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e,
70
+ 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
71
+ 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a,
72
+ 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
73
+ 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676,
74
+ 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
75
+ 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662,
76
+ 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
77
+ 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4,
78
+ ]);
79
+ export default class CRC32 {
80
+ /**
81
+ * Constructor initializes the CRC value
82
+ */
83
+ constructor() {
84
+ this.crc = 0xffffffff;
85
+ }
86
+ /**
87
+ * @return The current CRC
88
+ */
89
+ getCRC() {
90
+ return ~this.crc >>> 0; // return an unsigned value
91
+ }
92
+ /**
93
+ * Update the CRC with a single byte
94
+ * @param value The value to update the CRC with
95
+ */
96
+ updateCRC(value) {
97
+ this.crc =
98
+ (this.crc << 8) ^ crc32Lookup[((this.crc >>> 24) ^ value) & 0xff];
99
+ }
34
100
  /**
35
- * A static CRC lookup table
101
+ * Update the CRC with a sequence of identical bytes
102
+ * @param value The value to update the CRC with
103
+ * @param count The number of bytes
36
104
  */
37
- const crc32Lookup = new Uint32Array([
38
- 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
39
- 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
40
- 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
41
- 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
42
- 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3,
43
- 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
44
- 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef,
45
- 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
46
- 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb,
47
- 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
48
- 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0,
49
- 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
50
- 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4,
51
- 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
52
- 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08,
53
- 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
54
- 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc,
55
- 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
56
- 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050,
57
- 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
58
- 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34,
59
- 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
60
- 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1,
61
- 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
62
- 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5,
63
- 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
64
- 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9,
65
- 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
66
- 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd,
67
- 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
68
- 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71,
69
- 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
70
- 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2,
71
- 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
72
- 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e,
73
- 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
74
- 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a,
75
- 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
76
- 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676,
77
- 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
78
- 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662,
79
- 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
80
- 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4,
81
- ]);
82
- const CRC32 = function () {
83
- /**
84
- * The current CRC
85
- */
86
- let crc = 0xffffffff;
87
- /**
88
- * @return The current CRC
89
- */
90
- this.getCRC = function () {
91
- return ~crc >>> 0; // return an unsigned value
92
- };
93
- /**
94
- * Update the CRC with a single byte
95
- * @param value The value to update the CRC with
96
- */
97
- this.updateCRC = function (value) {
98
- crc = (crc << 8) ^ crc32Lookup[((crc >>> 24) ^ value) & 0xff];
99
- };
100
- /**
101
- * Update the CRC with a sequence of identical bytes
102
- * @param value The value to update the CRC with
103
- * @param count The number of bytes
104
- */
105
- this.updateCRCRun = function (value, count) {
106
- while (count-- > 0) {
107
- crc = (crc << 8) ^ crc32Lookup[((crc >>> 24) ^ value) & 0xff];
108
- }
109
- };
110
- };
111
- return CRC32;
112
- })();
105
+ updateCRCRun(value, count) {
106
+ while (count-- > 0) {
107
+ this.crc =
108
+ (this.crc << 8) ^ crc32Lookup[((this.crc >>> 24) ^ value) & 0xff];
109
+ }
110
+ }
111
+ }
113
112
  //# sourceMappingURL=crc32.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"crc32.js","sourceRoot":"","sources":["../../src/seek-bzip/crc32.ts"],"names":[],"mappings":";AAAA,cAAc;AAEd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,OAAO,GAAG,CAAC;IAChB;;OAEG;IACH,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC;QAClC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;QACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;QACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;QACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;QACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;QACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;QACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;QACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;QACtE,UAA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any, length: any): number;
4
+ writeByte(_byte: any): void;
5
+ seek(new_pos: any): void;
6
+ write(buffer: any, bufOffset: any, length: any): any;
7
+ flush(): void;
8
+ }
@@ -1,41 +1,34 @@
1
- "use strict";
2
1
  // @ts-nocheck
3
- /// * very simple input/output stream interface */
4
- const Stream = function () { };
5
- // input streams //////////////
6
- /** Returns the next byte, or -1 for EOF. */
7
- Stream.prototype.readByte = function () {
8
- throw new Error('abstract method readByte() not implemented');
9
- };
10
- /** Attempts to fill the buffer; returns number of bytes read, or
11
- * -1 for EOF. */
12
- Stream.prototype.read = function (buffer, bufOffset, length) {
13
- let bytesRead = 0;
14
- while (bytesRead < length) {
15
- const c = this.readByte();
16
- if (c < 0) {
17
- // EOF
18
- return bytesRead === 0 ? -1 : bytesRead;
2
+ export default class Stream {
3
+ readByte() {
4
+ throw new Error('abstract method readByte() not implemented');
5
+ }
6
+ read(buffer, bufOffset, length) {
7
+ let bytesRead = 0;
8
+ while (bytesRead < length) {
9
+ const c = this.readByte();
10
+ if (c < 0) {
11
+ // EOF
12
+ return bytesRead === 0 ? -1 : bytesRead;
13
+ }
14
+ buffer[bufOffset++] = c;
15
+ bytesRead++;
19
16
  }
20
- buffer[bufOffset++] = c;
21
- bytesRead++;
17
+ return bytesRead;
18
+ }
19
+ writeByte(_byte) {
20
+ throw new Error('abstract method readByte() not implemented');
22
21
  }
23
- return bytesRead;
24
- };
25
- Stream.prototype.seek = function (new_pos) {
26
- throw new Error('abstract method seek() not implemented');
27
- };
28
- // output streams ///////////
29
- Stream.prototype.writeByte = function (_byte) {
30
- throw new Error('abstract method readByte() not implemented');
31
- };
32
- Stream.prototype.write = function (buffer, bufOffset, length) {
33
- let i;
34
- for (i = 0; i < length; i++) {
35
- this.writeByte(buffer[bufOffset++]);
22
+ seek(new_pos) {
23
+ throw new Error('abstract method seek() not implemented');
24
+ }
25
+ write(buffer, bufOffset, length) {
26
+ let i;
27
+ for (i = 0; i < length; i++) {
28
+ this.writeByte(buffer[bufOffset++]);
29
+ }
30
+ return length;
36
31
  }
37
- return length;
38
- };
39
- Stream.prototype.flush = function () { };
40
- module.exports = Stream;
32
+ flush() { }
33
+ }
41
34
  //# sourceMappingURL=stream.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/seek-bzip/stream.ts"],"names":[],"mappings":";AAAA,cAAc;AACd,kDAAkD;AAClD,MAAM,MAAM,GAAG,cAAa,CAAC,CAAA;AAE7B,+BAA+B;AAC/B,4CAA4C;AAC5C,MAAM,CAAC,SAAS,CAAC,QAAQ,GAAG;IAC1B,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;AAC/D,CAAC,CAAA;AACD;kBACkB;AAClB,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,UAAU,MAAM,EAAE,SAAS,EAAE,MAAM;IACzD,IAAI,SAAS,GAAG,CAAC,CAAA;IACjB,OAAO,SAAS,GAAG,MAAM,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAA;QACzB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACV,MAAM;YACN,OAAO,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QACzC,CAAC;QACD,MAAM,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,CAAA;QACvB,SAAS,EAAE,CAAA;IACb,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AACD,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,UAAU,OAAO;IACvC,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;AAC3D,CAAC,CAAA;AAED,6BAA6B;AAC7B,MAAM,CAAC,SAAS,CAAC,SAAS,GAAG,UAAU,KAAK;IAC1C,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;AAC/D,CAAC,CAAA;AACD,MAAM,CAAC,SAAS,CAAC,KAA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M,EAAE,SAAS,EAAE,MAAM;QAC7B,IAAI,CAAC,CAAA;QACL,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;QACrC,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IACD,KAAK,KAAI,CAAC;CACX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmod/cram",
3
- "version": "5.0.2",
3
+ "version": "5.0.4",
4
4
  "description": "read CRAM files with pure Javascript",
5
5
  "license": "MIT",
6
6
  "repository": "GMOD/cram-js",
@@ -1,5 +1,3 @@
1
- // @ts-nocheck
2
-
3
1
  /* CRC32, used in Bzip2 implementation.
4
2
  * This is a port of CRC32.java from the jbzip2 implementation at
5
3
  * https://code.google.com/p/jbzip2
@@ -30,87 +28,94 @@
30
28
  * Copyright (c) 2013 C. Scott Ananian
31
29
  * with the same licensing terms as Matthew Francis' original implementation.
32
30
  */
33
- module.exports = (function () {
31
+ /**
32
+ * A static CRC lookup table
33
+ */
34
+ const crc32Lookup = new Uint32Array([
35
+ 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
36
+ 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
37
+ 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
38
+ 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
39
+ 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3,
40
+ 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
41
+ 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef,
42
+ 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
43
+ 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb,
44
+ 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
45
+ 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0,
46
+ 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
47
+ 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4,
48
+ 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
49
+ 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08,
50
+ 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
51
+ 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc,
52
+ 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
53
+ 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050,
54
+ 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
55
+ 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34,
56
+ 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
57
+ 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1,
58
+ 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
59
+ 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5,
60
+ 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
61
+ 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9,
62
+ 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
63
+ 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd,
64
+ 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
65
+ 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71,
66
+ 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
67
+ 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2,
68
+ 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
69
+ 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e,
70
+ 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
71
+ 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a,
72
+ 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
73
+ 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676,
74
+ 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
75
+ 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662,
76
+ 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
77
+ 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4,
78
+ ])
79
+
80
+ export default class CRC32 {
34
81
  /**
35
- * A static CRC lookup table
82
+ * The current CRC
83
+ * @private
36
84
  */
37
- const crc32Lookup = new Uint32Array([
38
- 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
39
- 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
40
- 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
41
- 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
42
- 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3,
43
- 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
44
- 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef,
45
- 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
46
- 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb,
47
- 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
48
- 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0,
49
- 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
50
- 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4,
51
- 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
52
- 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08,
53
- 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
54
- 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc,
55
- 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
56
- 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050,
57
- 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
58
- 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34,
59
- 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
60
- 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1,
61
- 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
62
- 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5,
63
- 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
64
- 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9,
65
- 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
66
- 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd,
67
- 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
68
- 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71,
69
- 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
70
- 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2,
71
- 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
72
- 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e,
73
- 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
74
- 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a,
75
- 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
76
- 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676,
77
- 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
78
- 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662,
79
- 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
80
- 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4,
81
- ])
85
+ private crc: number
82
86
 
83
- const CRC32 = function () {
84
- /**
85
- * The current CRC
86
- */
87
- let crc = 0xffffffff
87
+ /**
88
+ * Constructor initializes the CRC value
89
+ */
90
+ constructor() {
91
+ this.crc = 0xffffffff
92
+ }
88
93
 
89
- /**
90
- * @return The current CRC
91
- */
92
- this.getCRC = function () {
93
- return ~crc >>> 0 // return an unsigned value
94
- }
94
+ /**
95
+ * @return The current CRC
96
+ */
97
+ getCRC() {
98
+ return ~this.crc >>> 0 // return an unsigned value
99
+ }
95
100
 
96
- /**
97
- * Update the CRC with a single byte
98
- * @param value The value to update the CRC with
99
- */
100
- this.updateCRC = function (value) {
101
- crc = (crc << 8) ^ crc32Lookup[((crc >>> 24) ^ value) & 0xff]
102
- }
101
+ /**
102
+ * Update the CRC with a single byte
103
+ * @param value The value to update the CRC with
104
+ */
105
+ updateCRC(value: number) {
106
+ this.crc =
107
+ (this.crc << 8) ^ crc32Lookup[((this.crc >>> 24) ^ value) & 0xff]!
108
+ }
103
109
 
104
- /**
105
- * Update the CRC with a sequence of identical bytes
106
- * @param value The value to update the CRC with
107
- * @param count The number of bytes
108
- */
109
- this.updateCRCRun = function (value, count) {
110
- while (count-- > 0) {
111
- crc = (crc << 8) ^ crc32Lookup[((crc >>> 24) ^ value) & 0xff]
112
- }
110
+ /**
111
+ * Update the CRC with a sequence of identical bytes
112
+ * @param value The value to update the CRC with
113
+ * @param count The number of bytes
114
+ */
115
+ updateCRCRun(value: number, count: number) {
116
+ while (count-- > 0) {
117
+ this.crc =
118
+ (this.crc << 8) ^ crc32Lookup[((this.crc >>> 24) ^ value) & 0xff]!
113
119
  }
114
120
  }
115
- return CRC32
116
- })()
121
+ }
@@ -1,42 +1,33 @@
1
1
  // @ts-nocheck
2
- /// * very simple input/output stream interface */
3
- const Stream = function () {}
4
-
5
- // input streams //////////////
6
- /** Returns the next byte, or -1 for EOF. */
7
- Stream.prototype.readByte = function () {
8
- throw new Error('abstract method readByte() not implemented')
9
- }
10
- /** Attempts to fill the buffer; returns number of bytes read, or
11
- * -1 for EOF. */
12
- Stream.prototype.read = function (buffer, bufOffset, length) {
13
- let bytesRead = 0
14
- while (bytesRead < length) {
15
- const c = this.readByte()
16
- if (c < 0) {
17
- // EOF
18
- return bytesRead === 0 ? -1 : bytesRead
2
+ export default class Stream {
3
+ readByte() {
4
+ throw new Error('abstract method readByte() not implemented')
5
+ }
6
+ read(buffer, bufOffset, length) {
7
+ let bytesRead = 0
8
+ while (bytesRead < length) {
9
+ const c = this.readByte()
10
+ if (c < 0) {
11
+ // EOF
12
+ return bytesRead === 0 ? -1 : bytesRead
13
+ }
14
+ buffer[bufOffset++] = c
15
+ bytesRead++
19
16
  }
20
- buffer[bufOffset++] = c
21
- bytesRead++
17
+ return bytesRead
22
18
  }
23
- return bytesRead
24
- }
25
- Stream.prototype.seek = function (new_pos) {
26
- throw new Error('abstract method seek() not implemented')
27
- }
28
-
29
- // output streams ///////////
30
- Stream.prototype.writeByte = function (_byte) {
31
- throw new Error('abstract method readByte() not implemented')
32
- }
33
- Stream.prototype.write = function (buffer, bufOffset, length) {
34
- let i
35
- for (i = 0; i < length; i++) {
36
- this.writeByte(buffer[bufOffset++])
19
+ writeByte(_byte) {
20
+ throw new Error('abstract method readByte() not implemented')
21
+ }
22
+ seek(new_pos) {
23
+ throw new Error('abstract method seek() not implemented')
24
+ }
25
+ write(buffer, bufOffset, length) {
26
+ let i
27
+ for (i = 0; i < length; i++) {
28
+ this.writeByte(buffer[bufOffset++])
29
+ }
30
+ return length
37
31
  }
38
- return length
32
+ flush() {}
39
33
  }
40
- Stream.prototype.flush = function () {}
41
-
42
- module.exports = Stream