@loaders.gl/zip 4.0.4 → 4.1.0-alpha.10
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/dist/dist.dev.js +434 -27
- package/dist/filesystems/zip-filesystem.d.ts.map +1 -1
- package/dist/filesystems/zip-filesystem.js.map +1 -1
- package/dist/hash-file-utility.d.ts +6 -0
- package/dist/hash-file-utility.d.ts.map +1 -1
- package/dist/hash-file-utility.js +22 -0
- package/dist/hash-file-utility.js.map +1 -1
- package/dist/index.cjs +462 -32
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/tar/header.d.ts.map +1 -1
- package/dist/lib/tar/header.js.map +1 -1
- package/dist/lib/tar/tar.d.ts.map +1 -1
- package/dist/lib/tar/tar.js.map +1 -1
- package/dist/lib/tar/types.d.ts.map +1 -1
- package/dist/lib/tar/types.js.map +1 -1
- package/dist/lib/tar/utils.d.ts.map +1 -1
- package/dist/lib/tar/utils.js.map +1 -1
- package/dist/parse-zip/cd-file-header.d.ts +18 -0
- package/dist/parse-zip/cd-file-header.d.ts.map +1 -1
- package/dist/parse-zip/cd-file-header.js +101 -1
- package/dist/parse-zip/cd-file-header.js.map +1 -1
- package/dist/parse-zip/end-of-central-directory.d.ts +19 -0
- package/dist/parse-zip/end-of-central-directory.d.ts.map +1 -1
- package/dist/parse-zip/end-of-central-directory.js +41 -8
- package/dist/parse-zip/end-of-central-directory.js.map +1 -1
- package/dist/parse-zip/local-file-header.d.ts +16 -0
- package/dist/parse-zip/local-file-header.d.ts.map +1 -1
- package/dist/parse-zip/local-file-header.js +73 -1
- package/dist/parse-zip/local-file-header.js.map +1 -1
- package/dist/parse-zip/search-from-the-end.d.ts.map +1 -1
- package/dist/parse-zip/search-from-the-end.js.map +1 -1
- package/dist/parse-zip/zip-compozition.d.ts +8 -0
- package/dist/parse-zip/zip-compozition.d.ts.map +1 -0
- package/dist/parse-zip/zip-compozition.js +43 -0
- package/dist/parse-zip/zip-compozition.js.map +1 -0
- package/dist/parse-zip/zip64-info-generation.d.ts +24 -0
- package/dist/parse-zip/zip64-info-generation.d.ts.map +1 -0
- package/dist/parse-zip/zip64-info-generation.js +50 -0
- package/dist/parse-zip/zip64-info-generation.js.map +1 -0
- package/dist/tar-builder.d.ts.map +1 -1
- package/dist/tar-builder.js.map +1 -1
- package/dist/zip-loader.d.ts.map +1 -1
- package/dist/zip-loader.js +1 -1
- package/dist/zip-loader.js.map +1 -1
- package/dist/zip-writer.d.ts +2 -2
- package/dist/zip-writer.d.ts.map +1 -1
- package/dist/zip-writer.js +22 -7
- package/dist/zip-writer.js.map +1 -1
- package/package.json +7 -7
- package/src/filesystems/zip-filesystem.ts +2 -1
- package/src/hash-file-utility.ts +52 -2
- package/src/index.ts +8 -4
- package/src/lib/tar/header.ts +2 -1
- package/src/lib/tar/tar.ts +2 -1
- package/src/lib/tar/types.ts +2 -1
- package/src/lib/tar/utils.ts +2 -1
- package/src/parse-zip/cd-file-header.ts +185 -2
- package/src/parse-zip/end-of-central-directory.ts +99 -9
- package/src/parse-zip/local-file-header.ts +128 -2
- package/src/parse-zip/search-from-the-end.ts +2 -1
- package/src/parse-zip/zip-compozition.ts +113 -0
- package/src/parse-zip/zip64-info-generation.ts +106 -0
- package/src/tar-builder.ts +2 -1
- package/src/zip-loader.ts +2 -1
- package/src/zip-writer.ts +24 -10
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { compareArrayBuffers } from '@loaders.gl/loader-utils';
|
|
1
|
+
import { compareArrayBuffers, concatenateArrayBuffers } from '@loaders.gl/loader-utils';
|
|
2
|
+
import { createZip64Info, setFieldToNumber } from "./zip64-info-generation.js";
|
|
2
3
|
const COMPRESSION_METHOD_OFFSET = 8n;
|
|
3
4
|
const COMPRESSED_SIZE_OFFSET = 18n;
|
|
4
5
|
const UNCOMPRESSED_SIZE_OFFSET = 22n;
|
|
@@ -40,4 +41,75 @@ export const parseZipLocalFileHeader = async (headerOffset, buffer) => {
|
|
|
40
41
|
compressionMethod
|
|
41
42
|
};
|
|
42
43
|
};
|
|
44
|
+
export function generateLocalHeader(options) {
|
|
45
|
+
const optionsToUse = {
|
|
46
|
+
...options,
|
|
47
|
+
extraLength: 0,
|
|
48
|
+
fnlength: options.fileName.length
|
|
49
|
+
};
|
|
50
|
+
let zip64header = new ArrayBuffer(0);
|
|
51
|
+
const optionsToZip64 = {};
|
|
52
|
+
if (optionsToUse.length >= 0xffffffff) {
|
|
53
|
+
optionsToZip64.size = optionsToUse.length;
|
|
54
|
+
optionsToUse.length = 0xffffffff;
|
|
55
|
+
}
|
|
56
|
+
if (Object.keys(optionsToZip64).length) {
|
|
57
|
+
zip64header = createZip64Info(optionsToZip64);
|
|
58
|
+
optionsToUse.extraLength = zip64header.byteLength;
|
|
59
|
+
}
|
|
60
|
+
const header = new DataView(new ArrayBuffer(Number(FILE_NAME_OFFSET)));
|
|
61
|
+
for (const field of ZIP_HEADER_FIELDS) {
|
|
62
|
+
var _ref, _optionsToUse, _field$name;
|
|
63
|
+
setFieldToNumber(header, field.size, field.offset, (_ref = (_optionsToUse = optionsToUse[(_field$name = field.name) !== null && _field$name !== void 0 ? _field$name : '']) !== null && _optionsToUse !== void 0 ? _optionsToUse : field.default) !== null && _ref !== void 0 ? _ref : 0);
|
|
64
|
+
}
|
|
65
|
+
const encodedName = new TextEncoder().encode(optionsToUse.fileName);
|
|
66
|
+
const resHeader = concatenateArrayBuffers(header.buffer, encodedName, zip64header);
|
|
67
|
+
return resHeader;
|
|
68
|
+
}
|
|
69
|
+
const ZIP_HEADER_FIELDS = [{
|
|
70
|
+
offset: 0,
|
|
71
|
+
size: 4,
|
|
72
|
+
default: new DataView(signature.buffer).getUint32(0, true)
|
|
73
|
+
}, {
|
|
74
|
+
offset: 4,
|
|
75
|
+
size: 2,
|
|
76
|
+
default: 45
|
|
77
|
+
}, {
|
|
78
|
+
offset: 6,
|
|
79
|
+
size: 2,
|
|
80
|
+
default: 0
|
|
81
|
+
}, {
|
|
82
|
+
offset: 8,
|
|
83
|
+
size: 2,
|
|
84
|
+
default: 0
|
|
85
|
+
}, {
|
|
86
|
+
offset: 10,
|
|
87
|
+
size: 2,
|
|
88
|
+
default: 0
|
|
89
|
+
}, {
|
|
90
|
+
offset: 12,
|
|
91
|
+
size: 2,
|
|
92
|
+
default: 0
|
|
93
|
+
}, {
|
|
94
|
+
offset: 14,
|
|
95
|
+
size: 4,
|
|
96
|
+
name: 'crc32'
|
|
97
|
+
}, {
|
|
98
|
+
offset: 18,
|
|
99
|
+
size: 4,
|
|
100
|
+
name: 'length'
|
|
101
|
+
}, {
|
|
102
|
+
offset: 22,
|
|
103
|
+
size: 4,
|
|
104
|
+
name: 'length'
|
|
105
|
+
}, {
|
|
106
|
+
offset: 26,
|
|
107
|
+
size: 2,
|
|
108
|
+
name: 'fnlength'
|
|
109
|
+
}, {
|
|
110
|
+
offset: 28,
|
|
111
|
+
size: 2,
|
|
112
|
+
default: 0,
|
|
113
|
+
name: 'extraLength'
|
|
114
|
+
}];
|
|
43
115
|
//# sourceMappingURL=local-file-header.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-file-header.js","names":["compareArrayBuffers","COMPRESSION_METHOD_OFFSET","COMPRESSED_SIZE_OFFSET","UNCOMPRESSED_SIZE_OFFSET","FILE_NAME_LENGTH_OFFSET","EXTRA_FIELD_LENGTH_OFFSET","FILE_NAME_OFFSET","signature","Uint8Array","parseZipLocalFileHeader","headerOffset","buffer","magicBytes","slice","fileNameLength","getUint16","fileName","TextDecoder","decode","BigInt","split","join","extraFieldLength","fileDataOffset","compressionMethod","compressedSize","getUint32","uncompressedSize","extraOffset","offsetInZip64Data","getBigUint64"],"sources":["../../src/parse-zip/local-file-header.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {FileProvider, compareArrayBuffers} from '@loaders.gl/loader-utils';\nimport {ZipSignature} from './search-from-the-end';\n\n/**\n * zip local file header info\n * according to https://en.wikipedia.org/wiki/ZIP_(file_format)\n */\nexport type ZipLocalFileHeader = {\n /** File name length */\n fileNameLength: number;\n /** File name */\n fileName: string;\n /** Extra field length */\n extraFieldLength: number;\n /** Offset of the file data */\n fileDataOffset: bigint;\n /** Compressed size */\n compressedSize: bigint;\n /** Compression method */\n compressionMethod: number;\n};\n\n// offsets accroding to https://en.wikipedia.org/wiki/ZIP_(file_format)\nconst COMPRESSION_METHOD_OFFSET = 8n;\nconst COMPRESSED_SIZE_OFFSET = 18n;\nconst UNCOMPRESSED_SIZE_OFFSET = 22n;\nconst FILE_NAME_LENGTH_OFFSET = 26n;\nconst EXTRA_FIELD_LENGTH_OFFSET = 28n;\nconst FILE_NAME_OFFSET = 30n;\n\nexport const signature: ZipSignature = new Uint8Array([0x50, 0x4b, 0x03, 0x04]);\n\n/**\n * Parses local file header of zip file\n * @param headerOffset - offset in the archive where header starts\n * @param buffer - buffer containing whole array\n * @returns Info from the header\n */\nexport const parseZipLocalFileHeader = async (\n headerOffset: bigint,\n buffer: FileProvider\n): Promise<ZipLocalFileHeader | null> => {\n const magicBytes = await buffer.slice(headerOffset, headerOffset + 4n);\n if (!compareArrayBuffers(magicBytes, signature)) {\n return null;\n }\n\n const fileNameLength = await buffer.getUint16(headerOffset + FILE_NAME_LENGTH_OFFSET);\n\n const fileName = new TextDecoder()\n .decode(\n await buffer.slice(\n headerOffset + FILE_NAME_OFFSET,\n headerOffset + FILE_NAME_OFFSET + BigInt(fileNameLength)\n )\n )\n .split('\\\\')\n .join('/');\n const extraFieldLength = await buffer.getUint16(headerOffset + EXTRA_FIELD_LENGTH_OFFSET);\n\n let fileDataOffset = headerOffset + FILE_NAME_OFFSET + BigInt(fileNameLength + extraFieldLength);\n\n const compressionMethod = await buffer.getUint16(headerOffset + COMPRESSION_METHOD_OFFSET);\n\n let compressedSize = BigInt(await buffer.getUint32(headerOffset + COMPRESSED_SIZE_OFFSET)); // add zip 64 logic\n\n let uncompressedSize = BigInt(await buffer.getUint32(headerOffset + UNCOMPRESSED_SIZE_OFFSET)); // add zip 64 logic\n\n const extraOffset = headerOffset + FILE_NAME_OFFSET + BigInt(fileNameLength);\n\n let offsetInZip64Data = 4n;\n // looking for info that might be also be in zip64 extra field\n if (uncompressedSize === BigInt(0xffffffff)) {\n uncompressedSize = await buffer.getBigUint64(extraOffset + offsetInZip64Data);\n offsetInZip64Data += 8n;\n }\n if (compressedSize === BigInt(0xffffffff)) {\n compressedSize = await buffer.getBigUint64(extraOffset + offsetInZip64Data);\n offsetInZip64Data += 8n;\n }\n if (fileDataOffset === BigInt(0xffffffff)) {\n fileDataOffset = await buffer.getBigUint64(extraOffset + offsetInZip64Data); // setting it to the one from zip64\n }\n\n return {\n fileNameLength,\n fileName,\n extraFieldLength,\n fileDataOffset,\n compressedSize,\n compressionMethod\n };\n};\n"],"mappings":"AAGA,SAAsBA,mBAAmB,QAAO,0BAA0B;AAuB1E,MAAMC,yBAAyB,GAAG,EAAE;AACpC,MAAMC,sBAAsB,GAAG,GAAG;AAClC,MAAMC,wBAAwB,GAAG,GAAG;AACpC,MAAMC,uBAAuB,GAAG,GAAG;AACnC,MAAMC,yBAAyB,GAAG,GAAG;AACrC,MAAMC,gBAAgB,GAAG,GAAG;AAE5B,OAAO,MAAMC,SAAuB,GAAG,IAAIC,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAQ/E,OAAO,MAAMC,uBAAuB,GAAG,MAAAA,CACrCC,YAAoB,EACpBC,MAAoB,KACmB;EACvC,MAAMC,UAAU,GAAG,MAAMD,MAAM,CAACE,KAAK,CAACH,YAAY,EAAEA,YAAY,GAAG,EAAE,CAAC;EACtE,IAAI,CAACV,mBAAmB,CAACY,UAAU,EAAEL,SAAS,CAAC,EAAE;IAC/C,OAAO,IAAI;EACb;EAEA,MAAMO,cAAc,GAAG,MAAMH,MAAM,CAACI,SAAS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AiB,IAAI,EAAE;EACzB;EACA,IAAIN,cAAc,KAAKJ,MAAM,CAAC,UAAU,CAAC,EAAE;IACzCI,cAAc,GAAG,MAAMZ,MAAM,CAACmB,YAAY,CAACF,WAAW,GAAGC,iBAAiB,CAAC;EAC7E;EAEA,OAAO;IACLf,cAAc;IACdE,QAAQ;IACRM,gBAAgB;IAChBC,cAAc;IACdE,cAAc;IACdD;EACF,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"local-file-header.js","names":["compareArrayBuffers","concatenateArrayBuffers","createZip64Info","setFieldToNumber","COMPRESSION_METHOD_OFFSET","COMPRESSED_SIZE_OFFSET","UNCOMPRESSED_SIZE_OFFSET","FILE_NAME_LENGTH_OFFSET","EXTRA_FIELD_LENGTH_OFFSET","FILE_NAME_OFFSET","signature","Uint8Array","parseZipLocalFileHeader","headerOffset","buffer","magicBytes","slice","fileNameLength","getUint16","fileName","TextDecoder","decode","BigInt","split","join","extraFieldLength","fileDataOffset","compressionMethod","compressedSize","getUint32","uncompressedSize","extraOffset","offsetInZip64Data","getBigUint64","generateLocalHeader","options","optionsToUse","extraLength","fnlength","length","zip64header","ArrayBuffer","optionsToZip64","size","Object","keys","byteLength","header","DataView","Number","field","ZIP_HEADER_FIELDS","_ref","_optionsToUse","_field$name","offset","name","default","encodedName","TextEncoder","encode","resHeader"],"sources":["../../src/parse-zip/local-file-header.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {FileProvider, compareArrayBuffers, concatenateArrayBuffers} from '@loaders.gl/loader-utils';\nimport {ZipSignature} from './search-from-the-end';\nimport {createZip64Info, setFieldToNumber} from './zip64-info-generation';\n\n/**\n * zip local file header info\n * according to https://en.wikipedia.org/wiki/ZIP_(file_format)\n */\nexport type ZipLocalFileHeader = {\n /** File name length */\n fileNameLength: number;\n /** File name */\n fileName: string;\n /** Extra field length */\n extraFieldLength: number;\n /** Offset of the file data */\n fileDataOffset: bigint;\n /** Compressed size */\n compressedSize: bigint;\n /** Compression method */\n compressionMethod: number;\n};\n\n// offsets accroding to https://en.wikipedia.org/wiki/ZIP_(file_format)\nconst COMPRESSION_METHOD_OFFSET = 8n;\nconst COMPRESSED_SIZE_OFFSET = 18n;\nconst UNCOMPRESSED_SIZE_OFFSET = 22n;\nconst FILE_NAME_LENGTH_OFFSET = 26n;\nconst EXTRA_FIELD_LENGTH_OFFSET = 28n;\nconst FILE_NAME_OFFSET = 30n;\n\nexport const signature: ZipSignature = new Uint8Array([0x50, 0x4b, 0x03, 0x04]);\n\n/**\n * Parses local file header of zip file\n * @param headerOffset - offset in the archive where header starts\n * @param buffer - buffer containing whole array\n * @returns Info from the header\n */\nexport const parseZipLocalFileHeader = async (\n headerOffset: bigint,\n buffer: FileProvider\n): Promise<ZipLocalFileHeader | null> => {\n const magicBytes = await buffer.slice(headerOffset, headerOffset + 4n);\n if (!compareArrayBuffers(magicBytes, signature)) {\n return null;\n }\n\n const fileNameLength = await buffer.getUint16(headerOffset + FILE_NAME_LENGTH_OFFSET);\n\n const fileName = new TextDecoder()\n .decode(\n await buffer.slice(\n headerOffset + FILE_NAME_OFFSET,\n headerOffset + FILE_NAME_OFFSET + BigInt(fileNameLength)\n )\n )\n .split('\\\\')\n .join('/');\n const extraFieldLength = await buffer.getUint16(headerOffset + EXTRA_FIELD_LENGTH_OFFSET);\n\n let fileDataOffset = headerOffset + FILE_NAME_OFFSET + BigInt(fileNameLength + extraFieldLength);\n\n const compressionMethod = await buffer.getUint16(headerOffset + COMPRESSION_METHOD_OFFSET);\n\n let compressedSize = BigInt(await buffer.getUint32(headerOffset + COMPRESSED_SIZE_OFFSET)); // add zip 64 logic\n\n let uncompressedSize = BigInt(await buffer.getUint32(headerOffset + UNCOMPRESSED_SIZE_OFFSET)); // add zip 64 logic\n\n const extraOffset = headerOffset + FILE_NAME_OFFSET + BigInt(fileNameLength);\n\n let offsetInZip64Data = 4n;\n // looking for info that might be also be in zip64 extra field\n if (uncompressedSize === BigInt(0xffffffff)) {\n uncompressedSize = await buffer.getBigUint64(extraOffset + offsetInZip64Data);\n offsetInZip64Data += 8n;\n }\n if (compressedSize === BigInt(0xffffffff)) {\n compressedSize = await buffer.getBigUint64(extraOffset + offsetInZip64Data);\n offsetInZip64Data += 8n;\n }\n if (fileDataOffset === BigInt(0xffffffff)) {\n fileDataOffset = await buffer.getBigUint64(extraOffset + offsetInZip64Data); // setting it to the one from zip64\n }\n\n return {\n fileNameLength,\n fileName,\n extraFieldLength,\n fileDataOffset,\n compressedSize,\n compressionMethod\n };\n};\n\n/** info that can be placed into cd header */\ntype GenerateLocalOptions = {\n /** CRC-32 of uncompressed data */\n crc32: number;\n /** File name */\n fileName: string;\n /** File size */\n length: number;\n};\n\n/**\n * generates local header for the file\n * @param options info that can be placed into local header\n * @returns buffer with header\n */\nexport function generateLocalHeader(options: GenerateLocalOptions): ArrayBuffer {\n const optionsToUse = {\n ...options,\n extraLength: 0,\n fnlength: options.fileName.length\n };\n\n let zip64header: ArrayBuffer = new ArrayBuffer(0);\n\n const optionsToZip64: any = {};\n if (optionsToUse.length >= 0xffffffff) {\n optionsToZip64.size = optionsToUse.length;\n optionsToUse.length = 0xffffffff;\n }\n\n if (Object.keys(optionsToZip64).length) {\n zip64header = createZip64Info(optionsToZip64);\n optionsToUse.extraLength = zip64header.byteLength;\n }\n\n // base length without file name and extra info is static\n const header = new DataView(new ArrayBuffer(Number(FILE_NAME_OFFSET)));\n\n for (const field of ZIP_HEADER_FIELDS) {\n setFieldToNumber(\n header,\n field.size,\n field.offset,\n optionsToUse[field.name ?? ''] ?? field.default ?? 0\n );\n }\n\n const encodedName = new TextEncoder().encode(optionsToUse.fileName);\n\n const resHeader = concatenateArrayBuffers(header.buffer, encodedName, zip64header);\n\n return resHeader;\n}\n\nconst ZIP_HEADER_FIELDS = [\n // Local file header signature = 0x04034b50\n {\n offset: 0,\n size: 4,\n default: new DataView(signature.buffer).getUint32(0, true)\n },\n // Version needed to extract (minimum)\n {\n offset: 4,\n size: 2,\n default: 45\n },\n // General purpose bit flag\n {\n offset: 6,\n size: 2,\n default: 0\n },\n // Compression method\n {\n offset: 8,\n size: 2,\n default: 0\n },\n // File last modification time\n {\n offset: 10,\n size: 2,\n default: 0\n },\n // File last modification date\n {\n offset: 12,\n size: 2,\n default: 0\n },\n // CRC-32 of uncompressed data\n {\n offset: 14,\n size: 4,\n name: 'crc32'\n },\n // Compressed size (or 0xffffffff for ZIP64)\n {\n offset: 18,\n size: 4,\n name: 'length'\n },\n // Uncompressed size (or 0xffffffff for ZIP64)\n {\n offset: 22,\n size: 4,\n name: 'length'\n },\n // File name length (n)\n {\n offset: 26,\n size: 2,\n name: 'fnlength'\n },\n // Extra field length (m)\n {\n offset: 28,\n size: 2,\n default: 0,\n name: 'extraLength'\n }\n];\n"],"mappings":"AAIA,SAAsBA,mBAAmB,EAAEC,uBAAuB,QAAO,0BAA0B;AAAC,SAE5FC,eAAe,EAAEC,gBAAgB;AAsBzC,MAAMC,yBAAyB,GAAG,EAAE;AACpC,MAAMC,sBAAsB,GAAG,GAAG;AAClC,MAAMC,wBAAwB,GAAG,GAAG;AACpC,MAAMC,uBAAuB,GAAG,GAAG;AACnC,MAAMC,yBAAyB,GAAG,GAAG;AACrC,MAAMC,gBAAgB,GAAG,GAAG;AAE5B,OAAO,MAAMC,SAAuB,GAAG,IAAIC,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAQ/E,OAAO,MAAMC,uBAAuB,GAAG,MAAAA,CACrCC,YAAoB,EACpBC,MAAoB,KACmB;EACvC,MAAMC,UAAU,GAAG,MAAMD,MAAM,CAACE,KAAK,CAACH,YAAY,EAAEA,YAAY,GAAG,EAAE,CAAC;EACtE,IAAI,CAACb,mBAAmB,CAACe,UAAU,EAAEL,SAAS,CAAC,EAAE;IAC/C,OAAO,IAAI;EACb;EAEA,MAAMO,cAAc,GAAG,MAAMH,MAAM,CAACI,SAAS,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EAAE,EAAE;EACVZ,IAAI,EAAE,CAAC;EACPa,IAAI,EAAE;AACR,CAAC,EAED;EACED,MAAM,EAAE,EAAE;EACVZ,IAAI,EAAE,CAAC;EACPc,OAAO,EAAE,CAAC;EACVD,IAAI,EAAE;AACR,CAAC,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-from-the-end.d.ts","sourceRoot":"","sources":["../../src/parse-zip/search-from-the-end.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search-from-the-end.d.ts","sourceRoot":"","sources":["../../src/parse-zip/search-from-the-end.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAEtD,wCAAwC;AACxC,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,SACrB,YAAY,UACV,YAAY,KACnB,QAAQ,MAAM,CAuBhB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-from-the-end.js","names":["searchFromTheEnd","file","target","searchWindow","getUint8","length","undefined","targetOffset","i","every","val","index"],"sources":["../../src/parse-zip/search-from-the-end.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"search-from-the-end.js","names":["searchFromTheEnd","file","target","searchWindow","getUint8","length","undefined","targetOffset","i","every","val","index"],"sources":["../../src/parse-zip/search-from-the-end.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {FileProvider} from '@loaders.gl/loader-utils';\n\n/** Description of zip signature type */\nexport type ZipSignature = Uint8Array;\n\n/**\n * looking for the last occurrence of the provided\n * @param file\n * @param target\n * @returns\n */\nexport const searchFromTheEnd = async (\n file: FileProvider,\n target: ZipSignature\n): Promise<bigint> => {\n const searchWindow = [\n await file.getUint8(file.length - 1n),\n await file.getUint8(file.length - 2n),\n await file.getUint8(file.length - 3n),\n undefined\n ];\n\n let targetOffset = 0n;\n\n // looking for the last record in the central directory\n for (let i = file.length - 4n; i > -1; i--) {\n searchWindow[3] = searchWindow[2];\n searchWindow[2] = searchWindow[1];\n searchWindow[1] = searchWindow[0];\n searchWindow[0] = await file.getUint8(i);\n if (searchWindow.every((val, index) => val === target[index])) {\n targetOffset = i;\n break;\n }\n }\n\n return targetOffset;\n};\n"],"mappings":"AAeA,OAAO,MAAMA,gBAAgB,GAAG,MAAAA,CAC9BC,IAAkB,EAClBC,MAAoB,KACA;EACpB,MAAMC,YAAY,GAAG,CACnB,MAAMF,IAAI,CAACG,QAAQ,CAACH,IAAI,CAACI,MAAM,GAAG,EAAE,CAAC,EACrC,MAAMJ,IAAI,CAACG,QAAQ,CAACH,IAAI,CAACI,MAAM,GAAG,EAAE,CAAC,EACrC,MAAMJ,IAAI,CAACG,QAAQ,CAACH,IAAI,CAACI,MAAM,GAAG,EAAE,CAAC,EACrCC,SAAS,CACV;EAED,IAAIC,YAAY,GAAG,EAAE;EAGrB,KAAK,IAAIC,CAAC,GAAGP,IAAI,CAACI,MAAM,GAAG,EAAE,EAAEG,CAAC,GAAG,CAAC,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC1CL,YAAY,CAAC,CAAC,CAAC,GAAGA,YAAY,CAAC,CAAC,CAAC;IACjCA,YAAY,CAAC,CAAC,CAAC,GAAGA,YAAY,CAAC,CAAC,CAAC;IACjCA,YAAY,CAAC,CAAC,CAAC,GAAGA,YAAY,CAAC,CAAC,CAAC;IACjCA,YAAY,CAAC,CAAC,CAAC,GAAG,MAAMF,IAAI,CAACG,QAAQ,CAACI,CAAC,CAAC;IACxC,IAAIL,YAAY,CAACM,KAAK,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAKD,GAAG,KAAKR,MAAM,CAACS,KAAK,CAAC,CAAC,EAAE;MAC7DJ,YAAY,GAAGC,CAAC;MAChB;IACF;EACF;EAEA,OAAOD,YAAY;AACrB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* adds one file in the end of the archieve
|
|
3
|
+
* @param zipUrl path to the file
|
|
4
|
+
* @param fileToAdd new file body
|
|
5
|
+
* @param fileName new file name
|
|
6
|
+
*/
|
|
7
|
+
export declare function addOneFile(zipUrl: string, fileToAdd: ArrayBuffer, fileName: string): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=zip-compozition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip-compozition.d.ts","sourceRoot":"","sources":["../../src/parse-zip/zip-compozition.ts"],"names":[],"mappings":"AAuEA;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,iBAmCxF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { FileHandleFile, concatenateArrayBuffers } from '@loaders.gl/loader-utils';
|
|
2
|
+
import { parseEoCDRecord, updateEoCD } from "./end-of-central-directory.js";
|
|
3
|
+
import { CRC32Hash } from '@loaders.gl/crypto';
|
|
4
|
+
import { generateLocalHeader } from "./local-file-header.js";
|
|
5
|
+
import { generateCDHeader } from "./cd-file-header.js";
|
|
6
|
+
async function cutTheTailOff(provider) {
|
|
7
|
+
const oldEoCDinfo = await parseEoCDRecord(provider);
|
|
8
|
+
const oldCDStartOffset = oldEoCDinfo.cdStartOffset;
|
|
9
|
+
const oldCDLength = Number(oldEoCDinfo.offsets.zip64EoCDOffset ? oldEoCDinfo.offsets.zip64EoCDOffset - oldCDStartOffset : oldEoCDinfo.offsets.zipEoCDOffset - oldCDStartOffset);
|
|
10
|
+
const zipEnding = await provider.slice(oldCDStartOffset, provider.length);
|
|
11
|
+
await provider.truncate(Number(oldCDStartOffset));
|
|
12
|
+
const oldCDBody = zipEnding.slice(0, oldCDLength);
|
|
13
|
+
const eocdBody = zipEnding.slice(oldCDLength, zipEnding.byteLength);
|
|
14
|
+
return [oldCDBody, eocdBody, oldEoCDinfo];
|
|
15
|
+
}
|
|
16
|
+
async function generateFileHeaders(fileName, fileToAdd, localFileHeaderOffset) {
|
|
17
|
+
const newFileCRC322 = parseInt(await new CRC32Hash().hash(fileToAdd, 'hex'), 16);
|
|
18
|
+
const newFileLocalHeader = generateLocalHeader({
|
|
19
|
+
crc32: newFileCRC322,
|
|
20
|
+
fileName,
|
|
21
|
+
length: fileToAdd.byteLength
|
|
22
|
+
});
|
|
23
|
+
const newFileCDHeader = generateCDHeader({
|
|
24
|
+
crc32: newFileCRC322,
|
|
25
|
+
fileName,
|
|
26
|
+
offset: localFileHeaderOffset,
|
|
27
|
+
length: fileToAdd.byteLength
|
|
28
|
+
});
|
|
29
|
+
return [new Uint8Array(concatenateArrayBuffers(newFileLocalHeader, fileToAdd)), new Uint8Array(newFileCDHeader)];
|
|
30
|
+
}
|
|
31
|
+
export async function addOneFile(zipUrl, fileToAdd, fileName) {
|
|
32
|
+
const provider = new FileHandleFile(zipUrl, true);
|
|
33
|
+
const [oldCDBody, eocdBody, oldEoCDinfo] = await cutTheTailOff(provider);
|
|
34
|
+
const newFileOffset = provider.length;
|
|
35
|
+
const [localPart, cdHeaderPart] = await generateFileHeaders(fileName, fileToAdd, newFileOffset);
|
|
36
|
+
await provider.append(localPart);
|
|
37
|
+
const newCDBody = concatenateArrayBuffers(oldCDBody, cdHeaderPart);
|
|
38
|
+
const newCDStartOffset = provider.length;
|
|
39
|
+
await provider.append(new Uint8Array(newCDBody));
|
|
40
|
+
const eocdOffset = provider.length;
|
|
41
|
+
await provider.append(await updateEoCD(eocdBody, oldEoCDinfo.offsets, newCDStartOffset, eocdOffset, oldEoCDinfo.cdRecordsNumber + 1n));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=zip-compozition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip-compozition.js","names":["FileHandleFile","concatenateArrayBuffers","parseEoCDRecord","updateEoCD","CRC32Hash","generateLocalHeader","generateCDHeader","cutTheTailOff","provider","oldEoCDinfo","oldCDStartOffset","cdStartOffset","oldCDLength","Number","offsets","zip64EoCDOffset","zipEoCDOffset","zipEnding","slice","length","truncate","oldCDBody","eocdBody","byteLength","generateFileHeaders","fileName","fileToAdd","localFileHeaderOffset","newFileCRC322","parseInt","hash","newFileLocalHeader","crc32","newFileCDHeader","offset","Uint8Array","addOneFile","zipUrl","newFileOffset","localPart","cdHeaderPart","append","newCDBody","newCDStartOffset","eocdOffset","cdRecordsNumber"],"sources":["../../src/parse-zip/zip-compozition.ts"],"sourcesContent":["import {FileHandleFile, concatenateArrayBuffers} from '@loaders.gl/loader-utils';\nimport {ZipEoCDRecord, parseEoCDRecord, updateEoCD} from './end-of-central-directory';\nimport {CRC32Hash} from '@loaders.gl/crypto';\nimport {generateLocalHeader} from './local-file-header';\nimport {generateCDHeader} from './cd-file-header';\n\n/**\n * cut off CD and EoCD records from zip file\n * @param provider zip file\n * @returns tuple with three values: CD, EoCD record, EoCD information\n */\nasync function cutTheTailOff(\n provider: FileHandleFile\n): Promise<[ArrayBuffer, ArrayBuffer, ZipEoCDRecord]> {\n // define where the body ends\n const oldEoCDinfo = await parseEoCDRecord(provider);\n const oldCDStartOffset = oldEoCDinfo.cdStartOffset;\n\n // define cd length\n const oldCDLength = Number(\n oldEoCDinfo.offsets.zip64EoCDOffset\n ? oldEoCDinfo.offsets.zip64EoCDOffset - oldCDStartOffset\n : oldEoCDinfo.offsets.zipEoCDOffset - oldCDStartOffset\n );\n\n // cut off everything except of archieve body\n const zipEnding = await provider.slice(oldCDStartOffset, provider.length);\n await provider.truncate(Number(oldCDStartOffset));\n\n // divide cd body and eocd record\n const oldCDBody = zipEnding.slice(0, oldCDLength);\n const eocdBody = zipEnding.slice(oldCDLength, zipEnding.byteLength);\n\n return [oldCDBody, eocdBody, oldEoCDinfo];\n}\n\n/**\n * generates CD and local headers for the file\n * @param fileName name of the file\n * @param fileToAdd buffer with the file\n * @param localFileHeaderOffset offset of the file local header\n * @returns tuple with two values: local header and file body, cd header\n */\nasync function generateFileHeaders(\n fileName: string,\n fileToAdd: ArrayBuffer,\n localFileHeaderOffset: bigint\n): Promise<[Uint8Array, Uint8Array]> {\n // generating CRC32 of the content\n const newFileCRC322 = parseInt(await new CRC32Hash().hash(fileToAdd, 'hex'), 16);\n\n // generate local header for the file\n const newFileLocalHeader = generateLocalHeader({\n crc32: newFileCRC322,\n fileName,\n length: fileToAdd.byteLength\n });\n\n // generate hash file cd header\n const newFileCDHeader = generateCDHeader({\n crc32: newFileCRC322,\n fileName,\n offset: localFileHeaderOffset,\n length: fileToAdd.byteLength\n });\n return [\n new Uint8Array(concatenateArrayBuffers(newFileLocalHeader, fileToAdd)),\n new Uint8Array(newFileCDHeader)\n ];\n}\n\n/**\n * adds one file in the end of the archieve\n * @param zipUrl path to the file\n * @param fileToAdd new file body\n * @param fileName new file name\n */\nexport async function addOneFile(zipUrl: string, fileToAdd: ArrayBuffer, fileName: string) {\n // init file handler\n const provider = new FileHandleFile(zipUrl, true);\n\n const [oldCDBody, eocdBody, oldEoCDinfo] = await cutTheTailOff(provider);\n\n // remember the new file local header start offset\n const newFileOffset = provider.length;\n\n const [localPart, cdHeaderPart] = await generateFileHeaders(fileName, fileToAdd, newFileOffset);\n\n // write down the file local header\n await provider.append(localPart);\n\n // add the file CD header to the CD\n const newCDBody = concatenateArrayBuffers(oldCDBody, cdHeaderPart);\n\n // remember the CD start offset\n const newCDStartOffset = provider.length;\n\n // write down new CD\n await provider.append(new Uint8Array(newCDBody));\n\n // remember where eocd starts\n const eocdOffset = provider.length;\n\n await provider.append(\n await updateEoCD(\n eocdBody,\n oldEoCDinfo.offsets,\n newCDStartOffset,\n eocdOffset,\n oldEoCDinfo.cdRecordsNumber + 1n\n )\n );\n}\n"],"mappings":"AAAA,SAAQA,cAAc,EAAEC,uBAAuB,QAAO,0BAA0B;AAAC,SAC1DC,eAAe,EAAEC,UAAU;AAClD,SAAQC,SAAS,QAAO,oBAAoB;AAAC,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qB;IAC7BR,MAAM,EAAEO,SAAS,CAACH;EACpB,CAAC,CAAC;EACF,OAAO,CACL,IAAIY,UAAU,CAAClC,uBAAuB,CAAC8B,kBAAkB,EAAEL,SAAS,CAAC,CAAC,EACtE,IAAIS,UAAU,CAACF,eAAe,CAAC,CAChC;AACH;AAQA,OAAO,eAAeG,UAAUA,CAACC,MAAc,EAAEX,SAAsB,EAAED,QAAgB,EAAE;EAEzF,MAAMjB,QAAQ,GAAG,IAAIR,cAAc,CAACqC,MAAM,EAAE,IAAI,CAAC;EAEjD,MAAM,CAAChB,SAAS,EAAEC,QAAQ,EAAEb,WAAW,CAAC,GAAG,MAAMF,aAAa,CAACC,QAAQ,CAAC;EAGxE,MAAM8B,aAAa,GAAG9B,QAAQ,CAACW,MAAM;EAErC,MAAM,CAACoB,SAAS,EAAEC,YAAY,CAAC,GAAG,MAAMhB,mBAAmB,CAACC,QAAQ,EAAEC,SAAS,EAAEY,aAAa,CAAC;EAG/F,MAAM9B,QAAQ,CAACiC,MAAM,CAACF,SAAS,CAAC;EAGhC,MAAMG,SAAS,GAAGzC,uBAAuB,CAACoB,SAAS,EAAEmB,YAAY,CAAC;EAGlE,MAAMG,gBAAgB,GAAGnC,QAAQ,CAACW,MAAM;EAGxC,MAAMX,QAAQ,CAACiC,MAAM,CAAC,IAAIN,UAAU,CAACO,SAAS,CAAC,CAAC;EAGhD,MAAME,UAAU,GAAGpC,QAAQ,CAACW,MAAM;EAElC,MAAMX,QAAQ,CAACiC,MAAM,CACnB,MAAMtC,UAAU,CACdmB,QAAQ,EACRb,WAAW,CAACK,OAAO,EACnB6B,gBAAgB,EAChBC,UAAU,EACVnC,WAAW,CAACoC,eAAe,GAAG,EAChC,CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const signature: Uint8Array;
|
|
2
|
+
/** info that can be placed into zip64 field, doc: https://en.wikipedia.org/wiki/ZIP_(file_format)#ZIP64 */
|
|
3
|
+
type Zip64Options = {
|
|
4
|
+
/** Original uncompressed file size and Size of compressed data */
|
|
5
|
+
size?: number;
|
|
6
|
+
/** Offset of local header record */
|
|
7
|
+
offset?: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* creates zip64 extra field
|
|
11
|
+
* @param options info that can be placed into zip64 field
|
|
12
|
+
* @returns buffer with field
|
|
13
|
+
*/
|
|
14
|
+
export declare function createZip64Info(options: Zip64Options): ArrayBuffer;
|
|
15
|
+
/**
|
|
16
|
+
* Writes values into buffer according to the bytes amount
|
|
17
|
+
* @param header header where to write the data
|
|
18
|
+
* @param fieldSize size of the field in bytes
|
|
19
|
+
* @param fieldOffset offset of the field
|
|
20
|
+
* @param value value to be written
|
|
21
|
+
*/
|
|
22
|
+
export declare function setFieldToNumber(header: DataView, fieldSize: number, fieldOffset: number | bigint, value: number | bigint): void;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=zip64-info-generation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip64-info-generation.d.ts","sourceRoot":"","sources":["../../src/parse-zip/zip64-info-generation.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,YAA+B,CAAC;AAEtD,2GAA2G;AAC3G,KAAK,YAAY,GAAG;IAClB,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,WAAW,CAkBlE;AAUD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,QAAQ,EAChB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,KAAK,EAAE,MAAM,GAAG,MAAM,GACrB,IAAI,CAEN"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { concatenateArrayBuffers } from '@loaders.gl/loader-utils';
|
|
2
|
+
export const signature = new Uint8Array([0x01, 0x00]);
|
|
3
|
+
export function createZip64Info(options) {
|
|
4
|
+
const optionsToUse = {
|
|
5
|
+
...options,
|
|
6
|
+
zip64Length: (options.offset ? 1 : 0) * 8 + (options.size ? 1 : 0) * 16
|
|
7
|
+
};
|
|
8
|
+
const arraysToConcat = [];
|
|
9
|
+
for (const field of ZIP64_FIELDS) {
|
|
10
|
+
var _field$name, _optionsToUse, _field$name2;
|
|
11
|
+
if (!optionsToUse[(_field$name = field.name) !== null && _field$name !== void 0 ? _field$name : ''] && !field.default) {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
const newValue = new DataView(new ArrayBuffer(field.size));
|
|
15
|
+
NUMBER_SETTERS[field.size](newValue, 0, (_optionsToUse = optionsToUse[(_field$name2 = field.name) !== null && _field$name2 !== void 0 ? _field$name2 : '']) !== null && _optionsToUse !== void 0 ? _optionsToUse : field.default);
|
|
16
|
+
arraysToConcat.push(newValue.buffer);
|
|
17
|
+
}
|
|
18
|
+
return concatenateArrayBuffers(...arraysToConcat);
|
|
19
|
+
}
|
|
20
|
+
export function setFieldToNumber(header, fieldSize, fieldOffset, value) {
|
|
21
|
+
NUMBER_SETTERS[fieldSize](header, Number(fieldOffset), value);
|
|
22
|
+
}
|
|
23
|
+
const NUMBER_SETTERS = {
|
|
24
|
+
2: (header, offset, value) => {
|
|
25
|
+
header.setUint16(offset, Number(value), true);
|
|
26
|
+
},
|
|
27
|
+
4: (header, offset, value) => {
|
|
28
|
+
header.setUint32(offset, Number(value), true);
|
|
29
|
+
},
|
|
30
|
+
8: (header, offset, value) => {
|
|
31
|
+
header.setBigUint64(offset, BigInt(value), true);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const ZIP64_FIELDS = [{
|
|
35
|
+
size: 2,
|
|
36
|
+
default: new DataView(signature.buffer).getUint16(0, true)
|
|
37
|
+
}, {
|
|
38
|
+
size: 2,
|
|
39
|
+
name: 'zip64Length'
|
|
40
|
+
}, {
|
|
41
|
+
size: 8,
|
|
42
|
+
name: 'size'
|
|
43
|
+
}, {
|
|
44
|
+
size: 8,
|
|
45
|
+
name: 'size'
|
|
46
|
+
}, {
|
|
47
|
+
size: 8,
|
|
48
|
+
name: 'offset'
|
|
49
|
+
}];
|
|
50
|
+
//# sourceMappingURL=zip64-info-generation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip64-info-generation.js","names":["concatenateArrayBuffers","signature","Uint8Array","createZip64Info","options","optionsToUse","zip64Length","offset","size","arraysToConcat","field","ZIP64_FIELDS","_field$name","_optionsToUse","_field$name2","name","default","newValue","DataView","ArrayBuffer","NUMBER_SETTERS","push","buffer","setFieldToNumber","header","fieldSize","fieldOffset","value","Number","setUint16","setUint32","setBigUint64","BigInt","getUint16"],"sources":["../../src/parse-zip/zip64-info-generation.ts"],"sourcesContent":["import {concatenateArrayBuffers} from '@loaders.gl/loader-utils';\n\nexport const signature = new Uint8Array([0x01, 0x00]);\n\n/** info that can be placed into zip64 field, doc: https://en.wikipedia.org/wiki/ZIP_(file_format)#ZIP64 */\ntype Zip64Options = {\n /** Original uncompressed file size and Size of compressed data */\n size?: number;\n /** Offset of local header record */\n offset?: number;\n};\n\n/**\n * creates zip64 extra field\n * @param options info that can be placed into zip64 field\n * @returns buffer with field\n */\nexport function createZip64Info(options: Zip64Options): ArrayBuffer {\n const optionsToUse = {\n ...options,\n zip64Length: (options.offset ? 1 : 0) * 8 + (options.size ? 1 : 0) * 16\n };\n\n const arraysToConcat: ArrayBuffer[] = [];\n\n for (const field of ZIP64_FIELDS) {\n if (!optionsToUse[field.name ?? ''] && !field.default) {\n continue;\n }\n const newValue = new DataView(new ArrayBuffer(field.size));\n NUMBER_SETTERS[field.size](newValue, 0, optionsToUse[field.name ?? ''] ?? field.default);\n arraysToConcat.push(newValue.buffer);\n }\n\n return concatenateArrayBuffers(...arraysToConcat);\n}\n\n/**\n * Function to write values into buffer\n * @param header buffer where to write a value\n * @param offset offset of the writing start\n * @param value value to be written\n */\ntype NumberSetter = (header: DataView, offset: number, value: number | bigint) => void;\n\n/**\n * Writes values into buffer according to the bytes amount\n * @param header header where to write the data\n * @param fieldSize size of the field in bytes\n * @param fieldOffset offset of the field\n * @param value value to be written\n */\nexport function setFieldToNumber(\n header: DataView,\n fieldSize: number,\n fieldOffset: number | bigint,\n value: number | bigint\n): void {\n NUMBER_SETTERS[fieldSize](header, Number(fieldOffset), value);\n}\n\n/** functions to write values into buffer according to the bytes amount */\nconst NUMBER_SETTERS: {[key: number]: NumberSetter} = {\n 2: (header, offset, value) => {\n header.setUint16(offset, Number(value), true);\n },\n 4: (header, offset, value) => {\n header.setUint32(offset, Number(value), true);\n },\n 8: (header, offset, value) => {\n header.setBigUint64(offset, BigInt(value), true);\n }\n};\n\n/** zip64 info fields description, we need it as a pattern to build a zip64 info */\nconst ZIP64_FIELDS = [\n // Header ID 0x0001\n {\n size: 2,\n default: new DataView(signature.buffer).getUint16(0, true)\n },\n\n // Size of the extra field chunk (8, 16, 24 or 28)\n {\n size: 2,\n name: 'zip64Length'\n },\n\n // Original uncompressed file size\n {\n size: 8,\n name: 'size'\n },\n\n // Size of compressed data\n {\n size: 8,\n name: 'size'\n },\n\n // Offset of local header record\n {\n size: 8,\n name: 'offset'\n }\n];\n"],"mappings":"AAAA,SAAQA,uBAAuB,QAAO,0BAA0B;AAEhE,OAAO,MAAMC,SAAS,GAAG,IAAIC,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAerD,OAAO,SAASC,eAAeA,CAACC,OAAqB,EAAe;EAClE,MAAMC,YAAY,GAAG;IACnB,GAAGD,OAAO;IACVE,WAAW,EAAE,CAACF,OAAO,CAACG,MAAM,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAACH,OAAO,CAACI,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI;EACvE,CAAC;EAED,MAAMC,cAA6B,GAAG,EAAE;EAExC,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AC/C,CAAC;EACD,CAAC,EAAE,CAACH,MAAM,EAAEjB,MAAM,EAAEoB,KAAK,KAAK;IAC5BH,MAAM,CAACO,YAAY,CAACxB,MAAM,EAAEyB,MAAM,CAACL,KAAK,CAAC,EAAE,IAAI,CAAC;EAClD;AACF,CAAC;AAGD,MAAMhB,YAAY,GAAG,CAEnB;EACEH,IAAI,EAAE,CAAC;EACPQ,OAAO,EAAE,IAAIE,QAAQ,CAACjB,SAAS,CAACqB,MAAM,CAAC,CAACW,SAAS,CAAC,CAAC,EAAE,IAAI;AAC3D,CAAC,EAGD;EACEzB,IAAI,EAAE,CAAC;EACPO,IAAI,EAAE;AACR,CAAC,EAGD;EACEP,IAAI,EAAE,CAAC;EACPO,IAAI,EAAE;AACR,CAAC,EAGD;EACEP,IAAI,EAAE,CAAC;EACPO,IAAI,EAAE;AACR,CAAC,EAGD;EACEP,IAAI,EAAE,CAAC;EACPO,IAAI,EAAE;AACR,CAAC,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tar-builder.d.ts","sourceRoot":"","sources":["../src/tar-builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tar-builder.d.ts","sourceRoot":"","sources":["../src/tar-builder.ts"],"names":[],"mappings":"AAIA,OAAO,GAAG,MAAM,eAAe,CAAC;AAMhC,KAAK,iBAAiB,GAAG;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,qBAAa,UAAU;IACrB,MAAM,KAAK,UAAU;;;;;;;;;MASpB;IAED,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,MAAM,CAAK;gBAEN,OAAO,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC;IAIhD,kCAAkC;IAClC,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW;IAKvC,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC;CAGpC"}
|
package/dist/tar-builder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tar-builder.js","names":["Tar","TAR_BUILDER_OPTIONS","recordsPerBlock","TarBuilder","properties","id","name","extensions","mimeTypes","builder","options","constructor","tape","count","addFile","filename","buffer","append","Uint8Array","build","Response","save","arrayBuffer"],"sources":["../src/tar-builder.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"tar-builder.js","names":["Tar","TAR_BUILDER_OPTIONS","recordsPerBlock","TarBuilder","properties","id","name","extensions","mimeTypes","builder","options","constructor","tape","count","addFile","filename","buffer","append","Uint8Array","build","Response","save","arrayBuffer"],"sources":["../src/tar-builder.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport Tar from './lib/tar/tar';\n\nconst TAR_BUILDER_OPTIONS = {\n recordsPerBlock: 20\n};\n\ntype TarBuilderOptions = {\n recordsPerBlock?: number;\n};\n\n/**\n * Build a tar file by adding files\n */\nexport class TarBuilder {\n static get properties() {\n return {\n id: 'tar',\n name: 'TAR',\n extensions: ['tar'],\n mimeTypes: ['application/x-tar'],\n builder: TarBuilder,\n options: TAR_BUILDER_OPTIONS\n };\n }\n\n options: TarBuilderOptions;\n tape: Tar;\n count: number = 0;\n\n constructor(options?: Partial<TarBuilderOptions>) {\n this.options = {...TAR_BUILDER_OPTIONS, ...options};\n this.tape = new Tar(this.options.recordsPerBlock);\n }\n /** Adds a file to the archive. */\n addFile(filename: string, buffer: ArrayBuffer) {\n this.tape.append(filename, new Uint8Array(buffer));\n this.count++;\n }\n\n async build(): Promise<ArrayBuffer> {\n return new Response(this.tape.save()).arrayBuffer();\n }\n}\n"],"mappings":"OAIOA,GAAG;AAEV,MAAMC,mBAAmB,GAAG;EAC1BC,eAAe,EAAE;AACnB,CAAC;AASD,OAAO,MAAMC,UAAU,CAAC;EACtB,WAAWC,UAAUA,CAAA,EAAG;IACtB,OAAO;MACLC,EAAE,EAAE,KAAK;MACTC,IAAI,EAAE,KAAK;MACXC,UAAU,EAAE,CAAC,KAAK,CAAC;MACnBC,SAAS,EAAE,CAAC,mBAAmB,CAAC;MAChCC,OAAO,EAAEN,UAAU;MACnBO,OAAO,EAAET;IACX,CAAC;EACH;EAMAU,WAAWA,CAACD,OAAoC,EAAE;IAAA,KAJlDA,OAAO;IAAA,KACPE,IAAI;IAAA,KACJC,KAAK,GAAW,CAAC;IAGf,IAAI,CAACH,OAAO,GAAG;MAAC,GAAGT,mBAAmB;MAAE,GAAGS;IAAO,CAAC;IACnD,IAAI,CAACE,IAAI,GAAG,IAAIZ,GAAG,CAAC,IAAI,CAACU,OAAO,CAACR,eAAe,CAAC;EACnD;EAEAY,OAAOA,CAACC,QAAgB,EAAEC,MAAmB,EAAE;IAC7C,IAAI,CAACJ,IAAI,CAACK,MAAM,CAACF,QAAQ,EAAE,IAAIG,UAAU,CAACF,MAAM,CAAC,CAAC;IAClD,IAAI,CAACH,KAAK,EAAE;EACd;EAEA,MAAMM,KAAKA,CAAA,EAAyB;IAClC,OAAO,IAAIC,QAAQ,CAAC,IAAI,CAACR,IAAI,CAACS,IAAI,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;EACrD;AACF"}
|
package/dist/zip-loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zip-loader.d.ts","sourceRoot":"","sources":["../src/zip-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zip-loader.d.ts","sourceRoot":"","sources":["../src/zip-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAO9E,KAAK,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAE3C,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,CAWrE,CAAC"}
|
package/dist/zip-loader.js
CHANGED
package/dist/zip-loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zip-loader.js","names":["JSZip","VERSION","
|
|
1
|
+
{"version":3,"file":"zip-loader.js","names":["JSZip","VERSION","ZipLoader","id","module","name","version","extensions","mimeTypes","category","tests","options","parse","parseZipAsync","data","arguments","length","undefined","promises","fileMap","jsZip","zip","loadAsync","forEach","relativePath","zipEntry","subFilename","promise","loadZipEntry","then","arrayBufferOrError","push","Promise","all","error","log","arrayBuffer","file","async","dataType"],"sources":["../src/zip-loader.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport JSZip from 'jszip';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\ntype FileMap = Record<string, ArrayBuffer>;\n\nexport const ZipLoader: LoaderWithParser<FileMap, never, LoaderOptions> = {\n id: 'zip',\n module: 'zip',\n name: 'Zip Archive',\n version: VERSION,\n extensions: ['zip'],\n mimeTypes: ['application/zip'],\n category: 'archive',\n tests: ['PK'],\n options: {},\n parse: parseZipAsync\n};\n\n// TODO - Could return a map of promises, perhaps as an option...\nasync function parseZipAsync(data: any, options = {}): Promise<FileMap> {\n const promises: Promise<any>[] = [];\n const fileMap: Record<string, ArrayBuffer> = {};\n\n try {\n const jsZip = new JSZip();\n\n const zip = await jsZip.loadAsync(data, options);\n\n // start to load each file in this zip\n zip.forEach((relativePath, zipEntry) => {\n const subFilename = zipEntry.name;\n\n const promise = loadZipEntry(jsZip, subFilename, options).then((arrayBufferOrError) => {\n fileMap[relativePath] = arrayBufferOrError;\n });\n\n // Ensure Promise.all doesn't ignore rejected promises.\n promises.push(promise);\n });\n\n await Promise.all(promises);\n return fileMap;\n } catch (error) {\n // @ts-ignore\n options.log.error(`Unable to read zip archive: ${error}`);\n throw error;\n }\n}\n\nasync function loadZipEntry(jsZip: any, subFilename: string, options: any = {}) {\n // jszip supports both arraybuffer and text, the main loaders.gl types\n // https://stuk.github.io/jszip/documentation/api_zipobject/async.html\n try {\n const arrayBuffer = await jsZip.file(subFilename).async(options.dataType || 'arraybuffer');\n return arrayBuffer;\n } catch (error) {\n options.log.error(`Unable to read ${subFilename} from zip archive: ${error}`);\n // Store error in place of data in map\n return error;\n }\n}\n"],"mappings":"AAKA,OAAOA,KAAK,MAAM,OAAO;AAIzB,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAI3E,OAAO,MAAMC,SAA0D,GAAG;EACxEC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE,aAAa;EACnBC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,iBAAiB,CAAC;EAC9BC,QAAQ,EAAE,SAAS;EACnBC,KAAK,EAAE,CAAC,IAAI,CAAC;EACbC,OAAO,EAAE,CAAC,CAAC;EACXC,KAAK,EAAEC;AACT,CAAC;AAGD,eAAeA,aAAaA,CAACC,IAAS,EAAkC;EAAA,IAAhCH,OAAO,GAAAI,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAClD,MAAMG,QAAwB,GAAG,EAAE;EACnC,MAAMC,OAAoC,GAAG,CAAC,CAAC;EAE/C,IAAI;IACF,MAAMC,KAAK,GAAG,IAAIpB,KAAK,CAAC,CAAC;IAEzB,MAAMqB,GAAG,GAAG,MAAMD,KAAK,CAACE,SAAS,CAACR,IAAI,EAAEH,OAAO,CAAC;IAGhDU,GAAG,CAACE,OAAO,CAAC,CAACC,YAAY,EAAEC,QAAQ,KAAK;MACtC,MAAMC,WAAW,GAAGD,QAAQ,CAACpB,IAAI;MAEjC,MAAMsB,OAAO,GAAGC,YAAY,CAACR,KAAK,EAAEM,WAAW,EAAEf,OAAO,CAAC,CAACkB,IAAI,CAAEC,kBAAkB,IAAK;QACrFX,OAAO,CAACK,YAAY,CAAC,GAAGM,kBAAkB;MAC5C,CAAC,CAAC;MAGFZ,QAAQ,CAACa,IAAI,CAACJ,OAAO,CAAC;IACxB,CAAC,CAAC;IAEF,MAAMK,OAAO,CAACC,GAAG,CAACf,QAAQ,CAAC;IAC3B,OAAOC,OAAO;EAChB,CAAC,CAAC,OAAOe,KAAK,EAAE;IAEdvB,OAAO,CAACwB,GAAG,CAACD,KAAK,CAAE,+BAA8BA,KAAM,EAAC,CAAC;IACzD,MAAMA,KAAK;EACb;AACF;AAEA,eAAeN,YAAYA,CAACR,KAAU,EAAEM,WAAmB,EAAqB;EAAA,IAAnBf,OAAY,GAAAI,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAG5E,IAAI;IACF,MAAMqB,WAAW,GAAG,MAAMhB,KAAK,CAACiB,IAAI,CAACX,WAAW,CAAC,CAACY,KAAK,CAAC3B,OAAO,CAAC4B,QAAQ,IAAI,aAAa,CAAC;IAC1F,OAAOH,WAAW;EACpB,CAAC,CAAC,OAAOF,KAAK,EAAE;IACdvB,OAAO,CAACwB,GAAG,CAACD,KAAK,CAAE,kBAAiBR,WAAY,sBAAqBQ,KAAM,EAAC,CAAC;IAE7E,OAAOA,KAAK;EACd;AACF"}
|
package/dist/zip-writer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { WriterWithEncoder, WriterOptions } from '@loaders.gl/loader-utils';
|
|
2
2
|
import { JSZipGeneratorOptions } from 'jszip';
|
|
3
3
|
export type ZipWriterOptions = WriterOptions & {
|
|
4
4
|
zip?: {
|
|
@@ -12,5 +12,5 @@ export type ZipWriterOptions = WriterOptions & {
|
|
|
12
12
|
/**
|
|
13
13
|
* Zip exporter
|
|
14
14
|
*/
|
|
15
|
-
export declare const ZipWriter:
|
|
15
|
+
export declare const ZipWriter: WriterWithEncoder<Record<string, ArrayBuffer>, never, ZipWriterOptions>;
|
|
16
16
|
//# sourceMappingURL=zip-writer.d.ts.map
|
package/dist/zip-writer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zip-writer.d.ts","sourceRoot":"","sources":["../src/zip-writer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zip-writer.d.ts","sourceRoot":"","sources":["../src/zip-writer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,iBAAiB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC/E,OAAc,EAAC,qBAAqB,EAAC,MAAM,OAAO,CAAC;AAKnD,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE;YAAC,OAAO,EAAE,MAAM,CAAA;SAAC,KAAK,IAAI,CAAC;KAClD,CAAC;IACF,mCAAmC;IACnC,KAAK,CAAC,EAAE,qBAAqB,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAe7F,CAAC"}
|
package/dist/zip-writer.js
CHANGED
|
@@ -1,29 +1,44 @@
|
|
|
1
1
|
import JSZip from 'jszip';
|
|
2
|
+
const VERSION = typeof "4.1.0-alpha.10" !== 'undefined' ? "4.1.0-alpha.10" : 'latest';
|
|
2
3
|
export const ZipWriter = {
|
|
3
4
|
name: 'Zip Archive',
|
|
5
|
+
id: 'zip',
|
|
6
|
+
module: 'zip',
|
|
7
|
+
version: VERSION,
|
|
4
8
|
extensions: ['zip'],
|
|
5
9
|
category: 'archive',
|
|
6
10
|
mimeTypes: ['application/zip'],
|
|
11
|
+
options: {
|
|
12
|
+
zip: {
|
|
13
|
+
onUpdate: () => {}
|
|
14
|
+
},
|
|
15
|
+
jszip: {}
|
|
16
|
+
},
|
|
7
17
|
encode: encodeZipAsync
|
|
8
18
|
};
|
|
9
19
|
async function encodeZipAsync(fileMap) {
|
|
20
|
+
var _ZipWriter$options;
|
|
10
21
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
11
22
|
const jsZip = new JSZip();
|
|
12
23
|
for (const subFileName in fileMap) {
|
|
13
24
|
const subFileData = fileMap[subFileName];
|
|
14
25
|
jsZip.file(subFileName, subFileData, (options === null || options === void 0 ? void 0 : options.jszip) || {});
|
|
15
26
|
}
|
|
27
|
+
const zipOptions = {
|
|
28
|
+
...ZipWriter.options.zip,
|
|
29
|
+
...(options === null || options === void 0 ? void 0 : options.zip)
|
|
30
|
+
};
|
|
16
31
|
const jszipOptions = {
|
|
17
|
-
...(options === null || options === void 0 ? void 0 : options.jszip),
|
|
18
|
-
|
|
32
|
+
...((_ZipWriter$options = ZipWriter.options) === null || _ZipWriter$options === void 0 ? void 0 : _ZipWriter$options.jszip),
|
|
33
|
+
...options.jszip
|
|
19
34
|
};
|
|
20
|
-
const {
|
|
21
|
-
onUpdate = () => {}
|
|
22
|
-
} = options;
|
|
23
35
|
try {
|
|
24
|
-
return await jsZip.generateAsync(
|
|
36
|
+
return await jsZip.generateAsync({
|
|
37
|
+
...jszipOptions,
|
|
38
|
+
type: 'arraybuffer'
|
|
39
|
+
}, zipOptions.onUpdate);
|
|
25
40
|
} catch (error) {
|
|
26
|
-
options.log.error(`Unable to
|
|
41
|
+
options.log.error(`Unable to encode zip archive: ${error}`);
|
|
27
42
|
throw error;
|
|
28
43
|
}
|
|
29
44
|
}
|
package/dist/zip-writer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zip-writer.js","names":["JSZip","ZipWriter","name","extensions","category","mimeTypes","encode","encodeZipAsync","fileMap","options","arguments","length","undefined","jsZip","subFileName","subFileData","file","
|
|
1
|
+
{"version":3,"file":"zip-writer.js","names":["JSZip","VERSION","ZipWriter","name","id","module","version","extensions","category","mimeTypes","options","zip","onUpdate","jszip","encode","encodeZipAsync","fileMap","_ZipWriter$options","arguments","length","undefined","jsZip","subFileName","subFileData","file","zipOptions","jszipOptions","generateAsync","type","error","log"],"sources":["../src/zip-writer.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {WriterWithEncoder, WriterOptions} from '@loaders.gl/loader-utils';\nimport JSZip, {JSZipGeneratorOptions} from 'jszip';\n\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type ZipWriterOptions = WriterOptions & {\n zip?: {\n onUpdate?: (metadata: {percent: number}) => void;\n };\n /** Passthrough options to jszip */\n jszip?: JSZipGeneratorOptions;\n};\n\n/**\n * Zip exporter\n */\nexport const ZipWriter: WriterWithEncoder<Record<string, ArrayBuffer>, never, ZipWriterOptions> = {\n name: 'Zip Archive',\n id: 'zip',\n module: 'zip',\n version: VERSION,\n extensions: ['zip'],\n category: 'archive',\n mimeTypes: ['application/zip'],\n options: {\n zip: {\n onUpdate: () => {}\n },\n jszip: {}\n },\n encode: encodeZipAsync\n};\n\nasync function encodeZipAsync(\n fileMap: Record<string, ArrayBuffer>,\n options: ZipWriterOptions = {}\n): Promise<ArrayBuffer> {\n const jsZip = new JSZip();\n // add files to the zip\n for (const subFileName in fileMap) {\n const subFileData = fileMap[subFileName];\n\n // jszip supports both arraybuffer and string data (the main loaders.gl types)\n // https://stuk.github.io/jszip/documentation/api_zipobject/async.html\n jsZip.file(subFileName, subFileData, options?.jszip || {});\n }\n\n const zipOptions = {...ZipWriter.options.zip, ...options?.zip};\n const jszipOptions: JSZipGeneratorOptions = {...ZipWriter.options?.jszip, ...options.jszip};\n\n try {\n return await jsZip.generateAsync(\n {...jszipOptions, type: 'arraybuffer'}, // generate an arraybuffer\n zipOptions.onUpdate\n );\n } catch (error) {\n options.log.error(`Unable to encode zip archive: ${error}`);\n throw error;\n }\n}\n"],"mappings":"AAKA,OAAOA,KAAK,MAA+B,OAAO;AAGlD,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAa3E,OAAO,MAAMC,SAAkF,GAAG;EAChGC,IAAI,EAAE,aAAa;EACnBC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,QAAQ,EAAE,SAAS;EACnBC,SAAS,EAAE,CAAC,iBAAiB,CAAC;EAC9BC,OAAO,EAAE;IACPC,GAAG,EAAE;MACHC,QAAQ,EAAEA,CAAA,KAAM,CAAC;IACnB,CAAC;IACDC,KAAK,EAAE,CAAC;EACV,CAAC;EACDC,MAAM,EAAEC;AACV,CAAC;AAED,eAAeA,cAAcA,CAC3BC,OAAoC,EAEd;EAAA,IAAAC,kBAAA;EAAA,IADtBP,OAAyB,GAAAQ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAE9B,MAAMG,KAAK,GAAG,IAAIrB,KAAK,CAAC,CAAC;EAEzB,KAAK,MAAMsB,WAAW,IAAIN,OAAO,EAAE;IACjC,MAAMO,WAAW,GAAGP,OAAO,CAACM,WAAW,CAAC;IAIxCD,KAAK,CAACG,IAAI,CAACF,WAAW,EAAEC,WAAW,EAAE,CAAAb,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEG,KAAK,KAAI,CAAC,CAAC,CAAC;EAC5D;EAEA,MAAMY,UAAU,GAAG;IAAC,GAAGvB,SAAS,CAACQ,OAAO,CAACC,GAAG;IAAE,IAAGD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,GAAG;EAAA,CAAC;EAC9D,MAAMe,YAAmC,GAAG;IAAC,KAAAT,kBAAA,GAAGf,SAAS,CAACQ,OAAO,cAAAO,kBAAA,uBAAjBA,kBAAA,CAAmBJ,KAAK;IAAE,GAAGH,OAAO,CAACG;EAAK,CAAC;EAE3F,IAAI;IACF,OAAO,MAAMQ,KAAK,CAACM,aAAa,CAC9B;MAAC,GAAGD,YAAY;MAAEE,IAAI,EAAE;IAAa,CAAC,EACtCH,UAAU,CAACb,QACb,CAAC;EACH,CAAC,CAAC,OAAOiB,KAAK,EAAE;IACdnB,OAAO,CAACoB,GAAG,CAACD,KAAK,CAAE,iCAAgCA,KAAM,EAAC,CAAC;IAC3D,MAAMA,KAAK;EACb;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/zip",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.1.0-alpha.10",
|
|
4
4
|
"description": "Zip Archive Loader",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"module": "dist/index.js",
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
25
26
|
"import": "./dist/index.js",
|
|
26
|
-
"require": "./dist/index.cjs"
|
|
27
|
-
"types": "./dist/index.d.ts"
|
|
27
|
+
"require": "./dist/index.cjs"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"sideEffects": false,
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"build-bundle": "ocular-bundle ./src/index.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@loaders.gl/compression": "4.0.
|
|
42
|
-
"@loaders.gl/crypto": "4.0.
|
|
43
|
-
"@loaders.gl/loader-utils": "4.0.
|
|
41
|
+
"@loaders.gl/compression": "4.1.0-alpha.10",
|
|
42
|
+
"@loaders.gl/crypto": "4.1.0-alpha.10",
|
|
43
|
+
"@loaders.gl/loader-utils": "4.1.0-alpha.10",
|
|
44
44
|
"jszip": "^3.1.5",
|
|
45
45
|
"md5": "^2.3.0"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "19f43c2d90d8b50860c3f8e487429779a386287d"
|
|
48
48
|
}
|
package/src/hash-file-utility.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
// loaders.gl
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
|
|
4
5
|
import {MD5Hash} from '@loaders.gl/crypto';
|
|
5
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
FileProvider,
|
|
8
|
+
concatenateArrayBuffers,
|
|
9
|
+
concatenateArrayBuffersFromArray
|
|
10
|
+
} from '@loaders.gl/loader-utils';
|
|
6
11
|
import {makeZipCDHeaderIterator} from './parse-zip/cd-file-header';
|
|
7
12
|
|
|
8
13
|
/**
|
|
@@ -54,3 +59,48 @@ export async function makeHashTableFromZipHeaders(
|
|
|
54
59
|
|
|
55
60
|
return hashTable;
|
|
56
61
|
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* creates hash file that later can be added to the SLPK archive
|
|
65
|
+
* @param fileProvider SLPK archive where we need to add hash file
|
|
66
|
+
* @returns ArrayBuffer containing hash file
|
|
67
|
+
*/
|
|
68
|
+
export async function composeHashFile(fileProvider: FileProvider): Promise<ArrayBuffer> {
|
|
69
|
+
const hashArray = await makeHashTableFromZipHeaders(fileProvider);
|
|
70
|
+
const bufferArray = Object.entries(hashArray)
|
|
71
|
+
.map(([key, value]) => concatenateArrayBuffers(hexStringToBuffer(key), bigintToBuffer(value)))
|
|
72
|
+
.sort(compareHashes);
|
|
73
|
+
return concatenateArrayBuffersFromArray(bufferArray);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Function to compare md5 hashes according to https://github.com/Esri/i3s-spec/blob/master/docs/2.0/slpk_hashtable.pcsl.md
|
|
78
|
+
* @param arrA first hash to compare
|
|
79
|
+
* @param arrB second hash to compare
|
|
80
|
+
* @returns 0 if equal, negative number if a<b, pozitive if a>b
|
|
81
|
+
*/
|
|
82
|
+
function compareHashes(arrA: ArrayBuffer, arrB: ArrayBuffer): number {
|
|
83
|
+
const a = new BigUint64Array(arrA);
|
|
84
|
+
const b = new BigUint64Array(arrB);
|
|
85
|
+
|
|
86
|
+
return Number(a[0] === b[0] ? a[1] - b[1] : a[0] - b[0]);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* converts hex string to buffer
|
|
91
|
+
* @param str hex string to convert
|
|
92
|
+
* @returns conversion result
|
|
93
|
+
*/
|
|
94
|
+
function hexStringToBuffer(str: string): ArrayBuffer {
|
|
95
|
+
const byteArray = str.match(/../g)?.map((h) => parseInt(h, 16));
|
|
96
|
+
return new Uint8Array(byteArray ?? new Array(16)).buffer;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* converts bigint to buffer
|
|
101
|
+
* @param n bigint to convert
|
|
102
|
+
* @returns convertion result
|
|
103
|
+
*/
|
|
104
|
+
function bigintToBuffer(n: bigint): ArrayBuffer {
|
|
105
|
+
return new BigUint64Array([n]).buffer;
|
|
106
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// loaders.gl
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
|
|
4
5
|
export {ZipLoader} from './zip-loader';
|
|
@@ -8,16 +9,19 @@ export {TarBuilder} from './tar-builder';
|
|
|
8
9
|
export {
|
|
9
10
|
parseZipCDFileHeader,
|
|
10
11
|
makeZipCDHeaderIterator,
|
|
11
|
-
signature as
|
|
12
|
+
signature as CD_HEADER_SIGNATURE,
|
|
13
|
+
generateCDHeader
|
|
12
14
|
} from './parse-zip/cd-file-header';
|
|
13
15
|
export {
|
|
14
16
|
parseZipLocalFileHeader,
|
|
15
|
-
signature as localHeaderSignature
|
|
17
|
+
signature as localHeaderSignature,
|
|
18
|
+
generateLocalHeader
|
|
16
19
|
} from './parse-zip/local-file-header';
|
|
17
20
|
export {parseEoCDRecord} from './parse-zip/end-of-central-directory';
|
|
18
21
|
export {searchFromTheEnd} from './parse-zip/search-from-the-end';
|
|
22
|
+
export {addOneFile} from './parse-zip/zip-compozition';
|
|
19
23
|
|
|
20
24
|
// export type {HashElement} from './hash-file-utility';
|
|
21
|
-
export {parseHashTable, makeHashTableFromZipHeaders} from './hash-file-utility';
|
|
25
|
+
export {parseHashTable, makeHashTableFromZipHeaders, composeHashFile} from './hash-file-utility';
|
|
22
26
|
|
|
23
27
|
export {ZipFileSystem} from './filesystems/zip-filesystem';
|
package/src/lib/tar/header.ts
CHANGED