@sswroom/sswr 1.6.12 → 1.6.14

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.
package/text.d.ts CHANGED
@@ -12,6 +12,25 @@ export enum LineBreakType
12
12
  CRLF
13
13
  }
14
14
 
15
+ export enum HAlignment
16
+ {
17
+ Unknown,
18
+ Left,
19
+ Center,
20
+ Right,
21
+ Justify,
22
+ Fill
23
+ }
24
+
25
+ export enum VAlignment
26
+ {
27
+ Unknown,
28
+ Top,
29
+ Center,
30
+ Bottom,
31
+ Justify
32
+ }
33
+
15
34
  export function zeroPad(val: string | number, ndigits: number): string;
16
35
  export function isInteger(s: string): boolean;
17
36
  export function isUInteger(s: string): boolean;
package/text.js CHANGED
@@ -13,6 +13,23 @@ export const LineBreakType = {
13
13
  CRLF: "\r\n"
14
14
  };
15
15
 
16
+ export const HAlignment = {
17
+ Unknown: 0,
18
+ Left: 1,
19
+ Center: 2,
20
+ Right: 3,
21
+ Justify: 4,
22
+ Fill: 5
23
+ }
24
+
25
+ export const VAlignment = {
26
+ Unknown: 0,
27
+ Top: 1,
28
+ Center: 2,
29
+ Bottom: 3,
30
+ Justify: 4
31
+ }
32
+
16
33
  export function zeroPad(val, ndigits)
17
34
  {
18
35
  let s = "" + val;
@@ -625,12 +642,20 @@ export class UTF8TextBinEnc extends TextBinEnc
625
642
  super("UTF-8 Text");
626
643
  }
627
644
 
645
+ /**
646
+ * @param {Uint8Array} buff
647
+ * @returns {string}
648
+ */
628
649
  encodeBin(buff)
629
650
  {
630
651
  let enc = new TextDecoder();
631
652
  return enc.decode(buff);
632
653
  }
633
654
 
655
+ /**
656
+ * @param {string} str
657
+ * @returns {Uint8Array}
658
+ */
634
659
  decodeBin(str)
635
660
  {
636
661
  let enc = new TextEncoder();
package/zip.d.ts ADDED
@@ -0,0 +1,57 @@
1
+ import * as data from "./data";
2
+ import * as hash from "./hash";
3
+
4
+ export enum ZIPOS
5
+ {
6
+ MSDOS,
7
+ Amiga,
8
+ OpenVMS,
9
+ UNIX,
10
+ VM_CMS,
11
+ Atari_ST,
12
+ OS2_HPFS,
13
+ Macintosh,
14
+ ZSystem,
15
+ CP_M,
16
+ NTFS,
17
+ MVS,
18
+ VSE,
19
+ AcornRisc,
20
+ VFAT,
21
+ AlternateMVS,
22
+ BeOS,
23
+ Tandem,
24
+ OS400,
25
+ OSX
26
+ };
27
+
28
+ declare class FileInfo
29
+ {
30
+ fileName: string;
31
+ fileOfst: number;
32
+ fileModTime: data.Timestamp;
33
+ fileCreateTime: data.Timestamp;
34
+ fileAccessTime: data.Timestamp;
35
+ crcVal: number;
36
+ uncompSize: number;
37
+ compSize: number;
38
+ compMeth: number;
39
+ fileAttr: number;
40
+ }
41
+
42
+ export class ZIPBuilder
43
+ {
44
+ crc: hash.CRC32RIEEE;
45
+ builder: data.ByteBuilder;
46
+ baseOfst: number;
47
+ currOfst: number;
48
+ files: FileInfo[];
49
+ osType: ZIPOS;
50
+
51
+ constructor(os: ZIPOS);
52
+
53
+ addFile(fileName: string, fileContent: Uint8Array, lastModTime: data.Timestamp, lastAccessTime: data.Timestamp, createTime: data.Timestamp, unixAttr: number): boolean;
54
+ addDir(dirName: string, lastModTime: data.Timestamp, lastAccessTime: data.Timestamp, createTime: data.Timestamp, unixAttr: number): boolean;
55
+ addDeflate(fileName: string, buff: Uint8Array, decSize: number, crcVal: number, lastModTime: data.Timestamp, lastAccessTime: data.Timestamp, createTime: data.Timestamp, unixAttr: number): boolean;
56
+ finalize(): Uint8Array;
57
+ };
package/zip.js ADDED
@@ -0,0 +1,474 @@
1
+ import * as data from "./data.js";
2
+ import * as hash from "./hash.js"
3
+ import pako from "../../pako/dist/pako.esm.mjs";
4
+
5
+ const VERBOSE = true;
6
+ const ZIPVER = 63;
7
+
8
+
9
+ export const ZIPOS = {
10
+ MSDOS: 0,
11
+ Amiga: 1,
12
+ OpenVMS: 2,
13
+ UNIX: 3,
14
+ VM_CMS: 4,
15
+ Atari_ST: 5,
16
+ OS2_HPFS: 6,
17
+ Macintosh: 7,
18
+ ZSystem: 8,
19
+ CP_M: 9,
20
+ NTFS: 10,
21
+ MVS: 11,
22
+ VSE: 12,
23
+ AcornRisc: 13,
24
+ VFAT: 14,
25
+ AlternateMVS: 15,
26
+ BeOS: 16,
27
+ Tandem: 17,
28
+ OS400: 18,
29
+ OSX: 19
30
+ };
31
+
32
+ class FileInfo
33
+ {
34
+ /**
35
+ * @param {string} fileName
36
+ * @param {data.Timestamp} fileModTime
37
+ */
38
+ constructor(fileName, fileModTime)
39
+ {
40
+ this.fileName = fileName;
41
+ this.fileOfst = 0;
42
+ this.fileModTime = fileModTime;
43
+ /** @type {data.Timestamp|null} */
44
+ this.fileCreateTime = null;
45
+ /** @type {data.Timestamp|null} */
46
+ this.fileAccessTime = null;
47
+ this.crcVal = 0;
48
+ this.uncompSize = 0;
49
+ this.compSize = 0;
50
+ this.compMeth = 0;
51
+ this.fileAttr = 0;
52
+ }
53
+ }
54
+
55
+ export class ZIPBuilder
56
+ {
57
+ /**
58
+ * @param {number} os
59
+ */
60
+ constructor(os)
61
+ {
62
+ this.builder = new data.ByteBuilder();
63
+ this.currOfst = 0;
64
+ this.osType = os;
65
+ /** @type {FileInfo[]} */
66
+ this.files = [];
67
+ this.finalized = false;
68
+ this.crc = new hash.CRC32R(null);
69
+ }
70
+
71
+ /**
72
+ * @param {string} fileName
73
+ * @param {Uint8Array} fileContent
74
+ * @param {data.Timestamp} lastModTime
75
+ * @param {data.Timestamp} lastAccessTime
76
+ * @param {data.Timestamp} createTime
77
+ * @param {number} unixAttr
78
+ */
79
+ addFile(fileName, fileContent, lastModTime, lastAccessTime, createTime, unixAttr)
80
+ {
81
+ if (this.finalized)
82
+ return false;
83
+ let hdrLen;
84
+ let compSize;
85
+ let compData = pako.deflateRaw(fileContent);
86
+ let compress;
87
+ if (compData == null || compData.length >= fileContent.length)
88
+ {
89
+ compSize = fileContent.length;
90
+ compress = false;
91
+
92
+ }
93
+ else
94
+ {
95
+ compSize = compData.length;
96
+ compress = true;
97
+ }
98
+ let crcVal = this.crc.calcDirect(fileContent.buffer);
99
+ //Data::DateTime dt(lastModTime.inst, lastModTime.tzQhr);
100
+ let fileNameLen = this.builder.writeUTF8(this.currOfst + 30, fileName);
101
+ this.builder.writeInt32(this.currOfst + 0, 0x04034b50, true);
102
+ this.builder.writeInt8(this.currOfst + 4, 20); //Verison (2.0)
103
+ this.builder.writeInt8(this.currOfst + 5, this.osType);
104
+ this.builder.writeInt16(this.currOfst + 6, 0, true);
105
+ this.builder.writeInt16(this.currOfst + 8, 0x8, true);
106
+ this.builder.writeInt16(this.currOfst + 10, lastModTime.toMSDOSTime(), true);
107
+ this.builder.writeInt16(this.currOfst + 12, lastModTime.toMSDOSDate(), true);
108
+ this.builder.writeInt32(this.currOfst + 14, crcVal, true);
109
+ this.builder.writeInt32(this.currOfst + 18, compSize, true);
110
+ this.builder.writeInt32(this.currOfst + 22, fileContent.length, true);
111
+ this.builder.writeInt16(this.currOfst + 26, fileNameLen, true);
112
+ this.builder.writeInt16(this.currOfst + 28, 0, true);
113
+ hdrLen = 30 + fileNameLen;
114
+ if (compSize >= 0xFFFFFFFF || fileContent.length >= 0xFFFFFFFF)
115
+ {
116
+ let len = 4;
117
+ this.builder.writeInt16(this.currOfst + hdrLen, 1, true);
118
+ if (fileContent.length >= 0xffffffff)
119
+ {
120
+ this.builder.writeInt64(this.currOfst + hdrLen + len, BigInt(fileContent.length), true);
121
+ this.builder.writeInt32(this.currOfst + 22, 0xffffffff, true);
122
+ len += 8;
123
+ }
124
+ if (compSize >= 0xffffffff)
125
+ {
126
+ if (compSize >= fileContent.length)
127
+ {
128
+ this.builder.writeInt64(this.currOfst + hdrLen + len, BigInt(fileContent.length), true);
129
+ }
130
+ else
131
+ {
132
+ this.builder.writeInt64(this.currOfst + hdrLen + len, BigInt(compSize), true);
133
+ }
134
+ this.builder.writeInt32(this.currOfst + 18, 0xffffffff, true);
135
+ len += 8;
136
+ }
137
+ this.builder.writeInt16(this.currOfst + 28, len, true);
138
+ this.builder.writeInt16(this.currOfst + hdrLen + 2, len - 4, true);
139
+ hdrLen += len;
140
+ }
141
+
142
+ let file = new FileInfo(fileName, lastModTime);
143
+ file.fileCreateTime = createTime;
144
+ file.fileAccessTime = lastAccessTime;
145
+ file.crcVal = crcVal;
146
+ file.uncompSize = fileContent.length;
147
+ file.compMeth = 8;
148
+ file.compSize = compSize;
149
+ if (this.osType == ZIPOS.UNIX)
150
+ {
151
+ file.fileAttr = unixAttr << 16;
152
+ }
153
+ else if (unixAttr == 0)
154
+ {
155
+ file.fileAttr = 0;
156
+ }
157
+ else
158
+ {
159
+ if (unixAttr & 0x200)
160
+ {
161
+ file.fileAttr = 0;
162
+ }
163
+ else
164
+ {
165
+ file.fileAttr = 1;
166
+ }
167
+ }
168
+ file.fileOfst = this.currOfst;
169
+ this.files.push(file);
170
+ if (compress == false || compData == null || !(compData instanceof Uint8Array))
171
+ {
172
+ this.builder.writeInt16(this.currOfst + 8, 0x0, true);
173
+ this.builder.writeInt32(this.currOfst + 18, fileContent.length, true);
174
+ file.compMeth = 0;
175
+ file.compSize = fileContent.length;
176
+ this.currOfst += hdrLen;
177
+ this.builder.writeUInt8Array(this.currOfst, fileContent);
178
+ this.currOfst += fileContent.length;
179
+ }
180
+ else
181
+ {
182
+ this.currOfst += hdrLen;
183
+ this.builder.writeUInt8Array(this.currOfst, compData);
184
+ this.currOfst += compData.length;
185
+ }
186
+ return true;
187
+ }
188
+
189
+ /**
190
+ * @param {string} dirName
191
+ * @param {data.Timestamp} lastModTime
192
+ * @param {data.Timestamp} lastAccessTime
193
+ * @param {data.Timestamp} createTime
194
+ * @param {number} unixAttr
195
+ */
196
+ addDir(dirName, lastModTime, lastAccessTime, createTime, unixAttr)
197
+ {
198
+ if (this.finalized)
199
+ return false;
200
+ if (!dirName.endsWith('/'))
201
+ return false;
202
+
203
+ let hdrLen;
204
+ let dirNameLen = this.builder.writeUTF8(this.currOfst + 30, dirName);
205
+ this.builder.writeInt32(this.currOfst + 0, 0x04034b50, true);
206
+ this.builder.writeInt8(this.currOfst + 4, 45);
207
+ this.builder.writeInt8(this.currOfst + 5, this.osType);
208
+ this.builder.writeInt16(this.currOfst + 6, 0, true);
209
+ this.builder.writeInt16(this.currOfst + 8, 0, true);
210
+ this.builder.writeInt16(this.currOfst + 10, lastModTime.toMSDOSTime(), true);
211
+ this.builder.writeInt16(this.currOfst + 12, lastModTime.toMSDOSDate(), true);
212
+ this.builder.writeInt32(this.currOfst + 14, 0, true);
213
+ this.builder.writeInt32(this.currOfst + 18, 0, true);
214
+ this.builder.writeInt32(this.currOfst + 22, 0, true);
215
+ this.builder.writeInt16(this.currOfst + 26, dirNameLen, true);
216
+ this.builder.writeInt16(this.currOfst + 28, 0, true);
217
+ hdrLen = 30 + dirNameLen;
218
+
219
+ let file = new FileInfo(dirName, lastModTime);
220
+ file.fileCreateTime = createTime;
221
+ file.fileAccessTime = lastAccessTime;
222
+ file.crcVal = 0;
223
+ file.uncompSize = 0;
224
+ file.compMeth = 0;
225
+ file.compSize = 0;
226
+ if (this.osType == ZIPOS.UNIX)
227
+ {
228
+ file.fileAttr = (unixAttr << 16) | 0x10;
229
+ }
230
+ else if (unixAttr == 0)
231
+ {
232
+ file.fileAttr = 0x10;
233
+ }
234
+ else
235
+ {
236
+ if (unixAttr & 0x200)
237
+ {
238
+ file.fileAttr = 0x10;
239
+ }
240
+ else
241
+ {
242
+ file.fileAttr = 0x11;
243
+ }
244
+ }
245
+ file.fileOfst = this.currOfst;
246
+ this.files.push(file);
247
+ this.currOfst += hdrLen;
248
+ return true;
249
+ }
250
+
251
+ /**
252
+ * @param {string} fileName
253
+ * @param {Uint8Array} buff
254
+ * @param {number} decSize
255
+ * @param {number} crcVal
256
+ * @param {data.Timestamp} lastModTime
257
+ * @param {data.Timestamp} lastAccessTime
258
+ * @param {data.Timestamp} createTime
259
+ * @param {number} unixAttr
260
+ */
261
+ addDeflate(fileName, buff, decSize, crcVal, lastModTime, lastAccessTime, createTime, unixAttr)
262
+ {
263
+ if (this.finalized)
264
+ return false;
265
+ let hdrLen;
266
+ //Data::DateTime dt(lastModTime.inst, lastModTime.tzQhr);
267
+ let fileNameLen = this.builder.writeUTF8(this.currOfst + 30, fileName);
268
+ this.builder.writeInt32(this.currOfst + 0, 0x04034b50, true);
269
+ this.builder.writeInt8(this.currOfst + 4, 20); //Verison (2.0)
270
+ this.builder.writeInt8(this.currOfst + 5, this.osType);
271
+ this.builder.writeInt16(this.currOfst + 6, 0, true);
272
+ this.builder.writeInt16(this.currOfst + 8, 0x8, true);
273
+ this.builder.writeInt16(this.currOfst + 10, lastModTime.toMSDOSTime(), true);
274
+ this.builder.writeInt16(this.currOfst + 12, lastModTime.toMSDOSDate(), true);
275
+ this.builder.writeInt32(this.currOfst + 14, crcVal, true);
276
+ this.builder.writeInt32(this.currOfst + 18, buff.length, true);
277
+ this.builder.writeInt32(this.currOfst + 22, decSize, true);
278
+ this.builder.writeInt16(this.currOfst + 26, fileNameLen, true);
279
+ this.builder.writeInt16(this.currOfst + 28, 0, true);
280
+ hdrLen = 30 + fileNameLen;
281
+ if (buff.length >= 0xFFFFFFFF || decSize >= 0xFFFFFFFF)
282
+ {
283
+ let len = 4;
284
+ this.builder.writeInt16(this.currOfst + hdrLen, 1, true);
285
+ if (decSize >= 0xffffffff)
286
+ {
287
+ this.builder.writeInt64(this.currOfst + hdrLen + len, BigInt(decSize), true);
288
+ this.builder.writeInt32(this.currOfst + 22, 0xffffffff, true);
289
+ len += 8;
290
+ }
291
+ if (buff.length >= 0xffffffff)
292
+ {
293
+ this.builder.writeInt64(this.currOfst + hdrLen + len, BigInt(buff.length), true);
294
+ this.builder.writeInt32(this.currOfst + 18, 0xffffffff, true);
295
+ len += 8;
296
+ }
297
+ this.builder.writeInt16(this.currOfst + 28, len, true);
298
+ this.builder.writeInt16(this.currOfst + hdrLen + 2, len - 4, true);
299
+ hdrLen += len;
300
+ }
301
+
302
+ let file = new FileInfo(fileName, lastModTime);
303
+ file.fileCreateTime = createTime;
304
+ file.fileAccessTime = lastAccessTime;
305
+ file.crcVal = crcVal;
306
+ file.uncompSize = decSize;
307
+ file.compMeth = 8;
308
+ file.compSize = buff.length;
309
+ if (this.osType == ZIPOS.UNIX)
310
+ {
311
+ file.fileAttr = unixAttr << 16;
312
+ }
313
+ else if (unixAttr == 0)
314
+ {
315
+ file.fileAttr = 0;
316
+ }
317
+ else
318
+ {
319
+ if (unixAttr & 0x200)
320
+ {
321
+ file.fileAttr = 0;
322
+ }
323
+ else
324
+ {
325
+ file.fileAttr = 1;
326
+ }
327
+ }
328
+ file.fileOfst = this.currOfst;
329
+ this.files.push(file);
330
+ this.currOfst += hdrLen;
331
+ this.builder.writeUInt8Array(this.currOfst, buff);
332
+ this.currOfst += buff.length;
333
+ return true;
334
+ }
335
+
336
+ finalize()
337
+ {
338
+ if (!this.finalized)
339
+ {
340
+ this.finalized = true;
341
+
342
+ let cdStart = this.currOfst;
343
+ let file;
344
+ let hdrLen;
345
+ let cdLen = 0;
346
+ let i = 0;
347
+ let j = this.files.length;
348
+ let minVer;
349
+ while (i < j)
350
+ {
351
+ file = this.files[i];
352
+ minVer = 20;
353
+ let fileNameLen = this.builder.writeUTF8(this.currOfst + 46, file.fileName);
354
+ this.builder.writeInt32(this.currOfst + 0, 0x02014b50, true);
355
+ this.builder.writeInt8(this.currOfst + 4, ZIPVER);
356
+ this.builder.writeInt8(this.currOfst + 5, this.osType);
357
+ this.builder.writeInt8(this.currOfst + 7, this.osType);
358
+ this.builder.writeInt16(this.currOfst + 8, 0, true); //General purpose flag
359
+ this.builder.writeInt16(this.currOfst + 10, file.compMeth, true);
360
+ this.builder.writeInt16(this.currOfst + 12, file.fileModTime.toMSDOSTime(), true);
361
+ this.builder.writeInt16(this.currOfst + 14, file.fileModTime.toMSDOSDate(), true);
362
+ this.builder.writeInt32(this.currOfst + 16, file.crcVal, true);
363
+ this.builder.writeInt32(this.currOfst + 20, file.compSize, true);
364
+ this.builder.writeInt32(this.currOfst + 24, file.uncompSize, true);
365
+ this.builder.writeInt16(this.currOfst + 28, fileNameLen, true);
366
+ this.builder.writeInt16(this.currOfst + 30, 0, true); //extra field length
367
+ this.builder.writeInt16(this.currOfst + 32, 0, true); //File comment length
368
+ this.builder.writeInt16(this.currOfst + 34, 0, true); //Disk number where file starts
369
+ this.builder.writeInt16(this.currOfst + 36, 0, true); //Internal file attributes
370
+ this.builder.writeInt32(this.currOfst + 38, file.fileAttr, true); //External file attributes
371
+ this.builder.writeInt32(this.currOfst + 42, file.fileOfst, true);
372
+ hdrLen = 46 + fileNameLen;
373
+ if (file.compSize >= 0xFFFFFFFF || file.fileOfst >= 0xFFFFFFFF || file.uncompSize >= 0xFFFFFFFF)
374
+ {
375
+ let len = 0;
376
+ this.builder.writeInt16(this.currOfst + hdrLen, 1, true);
377
+ if (file.uncompSize >= 0xFFFFFFFFn)
378
+ {
379
+ this.builder.writeInt64(this.currOfst + hdrLen + 4 + len, BigInt(file.uncompSize), true);
380
+ this.builder.writeInt32(this.currOfst + 24, 0xffffffff, true);
381
+ len += 8;
382
+ }
383
+ if (file.compSize >= 0xFFFFFFFFn)
384
+ {
385
+ this.builder.writeInt64(this.currOfst + hdrLen + 4 + len, BigInt(file.compSize), true);
386
+ this.builder.writeInt32(this.currOfst + 20, 0xffffffff, true);
387
+ len += 8;
388
+ }
389
+ if (file.fileOfst >= 0xFFFFFFFFn)
390
+ {
391
+ this.builder.writeInt64(this.currOfst + hdrLen + 4 + len, BigInt(file.fileOfst), true);
392
+ this.builder.writeInt32(this.currOfst + 42, 0xffffffff, true);
393
+ len += 8;
394
+ }
395
+ this.builder.writeInt16(this.currOfst + hdrLen + 2, len, true);
396
+ hdrLen += 4 + len;
397
+ }
398
+ if (file.fileModTime != null && file.fileAccessTime != null && file.fileCreateTime != null)
399
+ {
400
+ if (minVer < 45)
401
+ minVer = 45;
402
+ this.builder.writeInt16(this.currOfst + hdrLen, 10, true);
403
+ this.builder.writeInt16(this.currOfst + hdrLen + 2, 32, true);
404
+ this.builder.writeInt32(this.currOfst + hdrLen + 4, 0, true);
405
+ this.builder.writeInt16(this.currOfst + hdrLen + 8, 1, true);
406
+ this.builder.writeInt16(this.currOfst + hdrLen + 10, 24, true);
407
+ this.builder.writeInt64(this.currOfst + hdrLen + 12, file.fileModTime.toFILETIME(), true);
408
+ this.builder.writeInt64(this.currOfst + hdrLen + 20, file.fileAccessTime.toFILETIME(), true);
409
+ this.builder.writeInt64(this.currOfst + hdrLen + 28, file.fileCreateTime.toFILETIME(), true);
410
+ hdrLen += 36;
411
+ }
412
+ this.builder.writeInt16(this.currOfst + 30, hdrLen - 46 - fileNameLen, true);
413
+ this.builder.writeInt8(this.currOfst + 6, minVer);
414
+
415
+ this.currOfst += hdrLen;
416
+ cdLen += hdrLen;
417
+
418
+ i++;
419
+ }
420
+ if (this.currOfst >= 0xffffffff || j >= 0xffff)
421
+ {
422
+ let cdOfst = this.currOfst;
423
+ this.builder.writeInt32(this.currOfst + 0, 0x06064b50, true); //Record Type (Zip64 End of central directory record)
424
+ this.builder.writeInt64(this.currOfst + 4, 44n, true); //Size of zip64 end of central directory record
425
+ this.builder.writeInt16(this.currOfst + 12, ZIPVER, true); //Version made by
426
+ this.builder.writeInt16(this.currOfst + 14, 45, true); //Version needed to extract
427
+ this.builder.writeInt32(this.currOfst + 16, 0, true); //Number of this disk
428
+ this.builder.writeInt32(this.currOfst + 20, 0, true); //Number of the disk with the start of the central directory
429
+ this.builder.writeInt64(this.currOfst + 24, BigInt(j), true); //Total number of entries in the central directory on this disk
430
+ this.builder.writeInt64(this.currOfst + 32, BigInt(j), true); //Total number of entries in the central directory
431
+ this.builder.writeInt64(this.currOfst + 40, BigInt(cdLen), true); //Size of central directory
432
+ this.builder.writeInt64(this.currOfst + 48, BigInt(cdStart), true); //Offset of start of central directory with respect to the starting disk number
433
+ this.currOfst += 56;
434
+
435
+ this.builder.writeInt32(this.currOfst + 0, 0x07064b50, true); //Record Type (Zip64 end of central directory locator)
436
+ this.builder.writeInt32(this.currOfst + 4, 0, true); //Number of the disk with the start of the zip64 end of central directory
437
+ this.builder.writeInt64(this.currOfst + 8, BigInt(cdOfst), true); //Relative offset of the zip64 end of central directory record
438
+ this.builder.writeInt32(this.currOfst + 16, 1, true); //Total number of disks
439
+ this.currOfst += 20;
440
+
441
+ this.builder.writeInt32(this.currOfst + 0, 0x06054b50, true); //Record Type (End of central directory record)
442
+ this.builder.writeInt16(this.currOfst + 4, 0, true); //Number of this disk
443
+ this.builder.writeInt16(this.currOfst + 6, 0, true); //Disk where central directory starts
444
+ if (j >= 0xffff)
445
+ {
446
+ this.builder.writeInt16(this.currOfst + 8, 0xffff, true); //Number of central directory of this disk
447
+ this.builder.writeInt16(this.currOfst + 10, 0xffff, true); //Total number of central directory records
448
+ }
449
+ else
450
+ {
451
+ this.builder.writeInt16(this.currOfst + 8, j, true); //Number of central directory of this disk
452
+ this.builder.writeInt16(this.currOfst + 10, j, true); //Total number of central directory records
453
+ }
454
+ this.builder.writeInt32(this.currOfst + 12, cdLen, true); //Size of central directory
455
+ this.builder.writeInt32(this.currOfst + 16, 0xffffffff, true); //Offset of start of central directory
456
+ this.builder.writeInt16(this.currOfst + 20, 0, true); //Comment Length
457
+ this.currOfst += 22;
458
+ }
459
+ else
460
+ {
461
+ this.builder.writeInt32(this.currOfst + 0, 0x06054b50, true); //Record Type (End of central directory record)
462
+ this.builder.writeInt16(this.currOfst + 4, 0, true); //Number of this disk
463
+ this.builder.writeInt16(this.currOfst + 6, 0, true); //Disk where central directory starts
464
+ this.builder.writeInt16(this.currOfst + 8, j, true); //Number of central directory of this disk
465
+ this.builder.writeInt16(this.currOfst + 10, j, true); //Total number of central directory records
466
+ this.builder.writeInt32(this.currOfst + 12, cdLen, true); //Size of central directory
467
+ this.builder.writeInt32(this.currOfst + 16, cdStart, true); //Offset of start of central directory
468
+ this.builder.writeInt16(this.currOfst + 20, 0, true); //Comment Length
469
+ this.currOfst += 22;
470
+ }
471
+ }
472
+ return this.builder.build();
473
+ }
474
+ }