@loaders.gl/i3s 4.0.0-alpha.14 → 4.0.0-alpha.16
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.min.js +329 -211
- package/dist/es5/arcgis-webscene-loader.js +1 -1
- package/dist/es5/i3s-attribute-loader.js +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js +1 -1
- package/dist/es5/i3s-content-loader.js +1 -1
- package/dist/es5/i3s-loader.js +1 -1
- package/dist/es5/i3s-node-page-loader.js +1 -1
- package/dist/es5/i3s-slpk-loader.js +30 -2
- package/dist/es5/i3s-slpk-loader.js.map +1 -1
- package/dist/es5/index.js +7 -7
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/parsers/constants.js +14 -15
- package/dist/es5/lib/parsers/constants.js.map +1 -1
- package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js +101 -76
- package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js.map +1 -1
- package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js +54 -34
- package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -1
- package/dist/es5/lib/parsers/parse-zip/cd-file-header.js +76 -39
- package/dist/es5/lib/parsers/parse-zip/cd-file-header.js.map +1 -1
- package/dist/es5/lib/parsers/parse-zip/data-view-file-provider.js +129 -0
- package/dist/es5/lib/parsers/parse-zip/data-view-file-provider.js.map +1 -0
- package/dist/es5/lib/parsers/parse-zip/end-of-central-directory.js +100 -0
- package/dist/es5/lib/parsers/parse-zip/end-of-central-directory.js.map +1 -0
- package/dist/es5/lib/parsers/parse-zip/file-provider.js.map +1 -1
- package/dist/es5/lib/parsers/parse-zip/local-file-header.js +55 -14
- package/dist/es5/lib/parsers/parse-zip/local-file-header.js.map +1 -1
- package/dist/es5/lib/parsers/parse-zip/search-from-the-end.js +69 -0
- package/dist/es5/lib/parsers/parse-zip/search-from-the-end.js.map +1 -0
- package/dist/es5/types.js +1 -14
- package/dist/es5/types.js.map +1 -1
- package/dist/esm/arcgis-webscene-loader.js +1 -1
- package/dist/esm/i3s-attribute-loader.js +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
- package/dist/esm/i3s-content-loader.js +1 -1
- package/dist/esm/i3s-loader.js +1 -1
- package/dist/esm/i3s-node-page-loader.js +1 -1
- package/dist/esm/i3s-slpk-loader.js +8 -2
- package/dist/esm/i3s-slpk-loader.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/parsers/constants.js +14 -15
- package/dist/esm/lib/parsers/constants.js.map +1 -1
- package/dist/esm/lib/parsers/parse-slpk/parse-slpk.js +50 -35
- package/dist/esm/lib/parsers/parse-slpk/parse-slpk.js.map +1 -1
- package/dist/esm/lib/parsers/parse-slpk/slpk-archieve.js +38 -22
- package/dist/esm/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -1
- package/dist/esm/lib/parsers/parse-zip/cd-file-header.js +30 -22
- package/dist/esm/lib/parsers/parse-zip/cd-file-header.js.map +1 -1
- package/dist/esm/lib/parsers/parse-zip/data-view-file-provider.js +32 -0
- package/dist/esm/lib/parsers/parse-zip/data-view-file-provider.js.map +1 -0
- package/dist/esm/lib/parsers/parse-zip/end-of-central-directory.js +33 -0
- package/dist/esm/lib/parsers/parse-zip/end-of-central-directory.js.map +1 -0
- package/dist/esm/lib/parsers/parse-zip/file-provider.js.map +1 -1
- package/dist/esm/lib/parsers/parse-zip/local-file-header.js +25 -10
- package/dist/esm/lib/parsers/parse-zip/local-file-header.js.map +1 -1
- package/dist/esm/lib/parsers/parse-zip/search-from-the-end.js +16 -0
- package/dist/esm/lib/parsers/parse-zip/search-from-the-end.js.map +1 -0
- package/dist/esm/types.js +0 -12
- package/dist/esm/types.js.map +1 -1
- package/dist/i3s-content-worker-node.js +47 -47
- package/dist/i3s-content-worker-node.js.map +2 -2
- package/dist/i3s-content-worker.js +22 -34
- package/dist/i3s-slpk-loader.d.ts +3 -0
- package/dist/i3s-slpk-loader.d.ts.map +1 -1
- package/dist/i3s-slpk-loader.js +11 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/parsers/constants.d.ts.map +1 -1
- package/dist/lib/parsers/constants.js +14 -15
- package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts +9 -3
- package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts.map +1 -1
- package/dist/lib/parsers/parse-slpk/parse-slpk.js +65 -42
- package/dist/lib/parsers/parse-slpk/slpk-archieve.d.ts +22 -10
- package/dist/lib/parsers/parse-slpk/slpk-archieve.d.ts.map +1 -1
- package/dist/lib/parsers/parse-slpk/slpk-archieve.js +56 -28
- package/dist/lib/parsers/parse-zip/cd-file-header.d.ts +9 -5
- package/dist/lib/parsers/parse-zip/cd-file-header.d.ts.map +1 -1
- package/dist/lib/parsers/parse-zip/cd-file-header.js +32 -25
- package/dist/lib/parsers/parse-zip/{buffer-file-provider.d.ts → data-view-file-provider.d.ts} +15 -16
- package/dist/lib/parsers/parse-zip/data-view-file-provider.d.ts.map +1 -0
- package/dist/lib/parsers/parse-zip/{buffer-file-provider.js → data-view-file-provider.js} +28 -14
- package/dist/lib/parsers/parse-zip/end-of-central-directory.d.ts +18 -0
- package/dist/lib/parsers/parse-zip/end-of-central-directory.d.ts.map +1 -0
- package/dist/lib/parsers/parse-zip/end-of-central-directory.js +41 -0
- package/dist/lib/parsers/parse-zip/file-provider.d.ts +10 -5
- package/dist/lib/parsers/parse-zip/file-provider.d.ts.map +1 -1
- package/dist/lib/parsers/parse-zip/local-file-header.d.ts +5 -3
- package/dist/lib/parsers/parse-zip/local-file-header.d.ts.map +1 -1
- package/dist/lib/parsers/parse-zip/local-file-header.js +30 -11
- package/dist/lib/parsers/parse-zip/search-from-the-end.d.ts +11 -0
- package/dist/lib/parsers/parse-zip/search-from-the-end.d.ts.map +1 -0
- package/dist/lib/parsers/parse-zip/search-from-the-end.js +31 -0
- package/dist/types.d.ts +17 -24
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -13
- package/package.json +9 -9
- package/src/i3s-slpk-loader.ts +19 -1
- package/src/index.ts +2 -2
- package/src/lib/parsers/constants.ts +14 -15
- package/src/lib/parsers/parse-slpk/parse-slpk.ts +83 -58
- package/src/lib/parsers/parse-slpk/slpk-archieve.ts +59 -44
- package/src/lib/parsers/parse-zip/cd-file-header.ts +52 -32
- package/src/lib/parsers/parse-zip/data-view-file-provider.ts +69 -0
- package/src/lib/parsers/parse-zip/end-of-central-directory.ts +78 -0
- package/src/lib/parsers/parse-zip/file-provider.ts +11 -5
- package/src/lib/parsers/parse-zip/local-file-header.ts +45 -19
- package/src/lib/parsers/parse-zip/search-from-the-end.ts +38 -0
- package/src/types.ts +25 -40
- package/dist/es5/lib/parsers/parse-zip/buffer-file-provider.js +0 -46
- package/dist/es5/lib/parsers/parse-zip/buffer-file-provider.js.map +0 -1
- package/dist/esm/lib/parsers/parse-zip/buffer-file-provider.js +0 -23
- package/dist/esm/lib/parsers/parse-zip/buffer-file-provider.js.map +0 -1
- package/dist/lib/parsers/parse-zip/buffer-file-provider.d.ts.map +0 -1
- package/src/lib/parsers/parse-zip/buffer-file-provider.ts +0 -55
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {FileProvider} from './file-provider';
|
|
2
|
+
import {ZipSignature} from './search-from-the-end';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* zip central directory file header info
|
|
@@ -6,19 +7,32 @@ import {FileProvider} from './file-provider';
|
|
|
6
7
|
*/
|
|
7
8
|
export type ZipCDFileHeader = {
|
|
8
9
|
/** Compressed size */
|
|
9
|
-
compressedSize:
|
|
10
|
+
compressedSize: bigint;
|
|
10
11
|
/** Uncompressed size */
|
|
11
|
-
uncompressedSize:
|
|
12
|
+
uncompressedSize: bigint;
|
|
13
|
+
/** Extra field size */
|
|
14
|
+
extraFieldLength: number;
|
|
12
15
|
/** File name length */
|
|
13
16
|
fileNameLength: number;
|
|
14
17
|
/** File name */
|
|
15
18
|
fileName: string;
|
|
16
19
|
/** Extra field offset */
|
|
17
|
-
extraOffset:
|
|
20
|
+
extraOffset: bigint;
|
|
18
21
|
/** Relative offset of local file header */
|
|
19
|
-
localHeaderOffset:
|
|
22
|
+
localHeaderOffset: bigint;
|
|
20
23
|
};
|
|
21
24
|
|
|
25
|
+
const offsets = {
|
|
26
|
+
CD_COMPRESSED_SIZE_OFFSET: 20n,
|
|
27
|
+
CD_UNCOMPRESSED_SIZE_OFFSET: 24n,
|
|
28
|
+
CD_FILE_NAME_LENGTH_OFFSET: 28n,
|
|
29
|
+
CD_EXTRA_FIELD_LENGTH_OFFSET: 30n,
|
|
30
|
+
CD_LOCAL_HEADER_OFFSET_OFFSET: 42n,
|
|
31
|
+
CD_FILE_NAME_OFFSET: 46n
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const signature: ZipSignature = [0x50, 0x4b, 0x01, 0x02];
|
|
35
|
+
|
|
22
36
|
/**
|
|
23
37
|
* Parses central directory file header of zip file
|
|
24
38
|
* @param headerOffset - offset in the archive where header starts
|
|
@@ -26,22 +40,27 @@ export type ZipCDFileHeader = {
|
|
|
26
40
|
* @returns Info from the header
|
|
27
41
|
*/
|
|
28
42
|
export const parseZipCDFileHeader = async (
|
|
29
|
-
headerOffset:
|
|
43
|
+
headerOffset: bigint,
|
|
30
44
|
buffer: FileProvider
|
|
31
|
-
): Promise<ZipCDFileHeader> => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
45
|
+
): Promise<ZipCDFileHeader | null> => {
|
|
46
|
+
if (
|
|
47
|
+
Buffer.from(await buffer.slice(headerOffset, headerOffset + 4n)).compare(
|
|
48
|
+
Buffer.from(signature)
|
|
49
|
+
) !== 0
|
|
50
|
+
) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
40
53
|
|
|
41
|
-
|
|
54
|
+
let compressedSize = BigInt(
|
|
55
|
+
await buffer.getUint32(headerOffset + offsets.CD_COMPRESSED_SIZE_OFFSET)
|
|
56
|
+
);
|
|
42
57
|
|
|
43
|
-
|
|
44
|
-
headerOffset + offsets.CD_UNCOMPRESSED_SIZE_OFFSET
|
|
58
|
+
let uncompressedSize = BigInt(
|
|
59
|
+
await buffer.getUint32(headerOffset + offsets.CD_UNCOMPRESSED_SIZE_OFFSET)
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const extraFieldLength = await buffer.getUint16(
|
|
63
|
+
headerOffset + offsets.CD_EXTRA_FIELD_LENGTH_OFFSET
|
|
45
64
|
);
|
|
46
65
|
|
|
47
66
|
const fileNameLength = await buffer.getUint16(headerOffset + offsets.CD_FILE_NAME_LENGTH_OFFSET);
|
|
@@ -49,35 +68,36 @@ export const parseZipCDFileHeader = async (
|
|
|
49
68
|
const fileName = new TextDecoder().decode(
|
|
50
69
|
await buffer.slice(
|
|
51
70
|
headerOffset + offsets.CD_FILE_NAME_OFFSET,
|
|
52
|
-
headerOffset + offsets.CD_FILE_NAME_OFFSET + fileNameLength
|
|
71
|
+
headerOffset + offsets.CD_FILE_NAME_OFFSET + BigInt(fileNameLength)
|
|
53
72
|
)
|
|
54
73
|
);
|
|
55
74
|
|
|
56
|
-
const extraOffset = headerOffset + offsets.CD_FILE_NAME_OFFSET + fileNameLength;
|
|
75
|
+
const extraOffset = headerOffset + offsets.CD_FILE_NAME_OFFSET + BigInt(fileNameLength);
|
|
57
76
|
|
|
58
77
|
const oldFormatOffset = await buffer.getUint32(
|
|
59
78
|
headerOffset + offsets.CD_LOCAL_HEADER_OFFSET_OFFSET
|
|
60
79
|
);
|
|
61
80
|
|
|
62
|
-
let fileDataOffset = oldFormatOffset;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
fileDataOffset = await buffer.
|
|
81
|
+
let fileDataOffset = BigInt(oldFormatOffset);
|
|
82
|
+
let offsetInZip64Data = 4n;
|
|
83
|
+
// looking for info that might be also be in zip64 extra field
|
|
84
|
+
if (uncompressedSize === BigInt(0xffffffff)) {
|
|
85
|
+
uncompressedSize = await buffer.getBigUint64(extraOffset + offsetInZip64Data);
|
|
86
|
+
offsetInZip64Data += 8n;
|
|
87
|
+
}
|
|
88
|
+
if (compressedSize === BigInt(0xffffffff)) {
|
|
89
|
+
compressedSize = await buffer.getBigUint64(extraOffset + offsetInZip64Data);
|
|
90
|
+
offsetInZip64Data += 8n;
|
|
91
|
+
}
|
|
92
|
+
if (fileDataOffset === BigInt(0xffffffff)) {
|
|
93
|
+
fileDataOffset = await buffer.getBigUint64(extraOffset + offsetInZip64Data); // setting it to the one from zip64
|
|
75
94
|
}
|
|
76
95
|
const localHeaderOffset = fileDataOffset;
|
|
77
96
|
|
|
78
97
|
return {
|
|
79
98
|
compressedSize,
|
|
80
99
|
uncompressedSize,
|
|
100
|
+
extraFieldLength,
|
|
81
101
|
fileNameLength,
|
|
82
102
|
fileName,
|
|
83
103
|
extraOffset,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {FileProvider} from './file-provider';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checks if bigint can be converted to number and convert it if possible
|
|
5
|
+
* @param bigint bigint to be converted
|
|
6
|
+
* @returns number
|
|
7
|
+
*/
|
|
8
|
+
const toNumber = (bigint: bigint) => {
|
|
9
|
+
if (bigint > Number.MAX_SAFE_INTEGER) {
|
|
10
|
+
throw new Error('Offset is out of bounds');
|
|
11
|
+
}
|
|
12
|
+
return Number(bigint);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** Provides file data using DataView */
|
|
16
|
+
export class DataViewFileProvider implements FileProvider {
|
|
17
|
+
/** The DataView from which data is provided */
|
|
18
|
+
private file: DataView;
|
|
19
|
+
|
|
20
|
+
constructor(file: DataView) {
|
|
21
|
+
this.file = file;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
|
|
26
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
27
|
+
*/
|
|
28
|
+
async getUint8(offset: bigint): Promise<number> {
|
|
29
|
+
return this.file.getUint8(toNumber(offset));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Gets an unsigned 16-bit intege at the specified byte offset from the start of the file.
|
|
34
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
35
|
+
*/
|
|
36
|
+
async getUint16(offset: bigint): Promise<number> {
|
|
37
|
+
return this.file.getUint16(toNumber(offset), true);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
42
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
43
|
+
*/
|
|
44
|
+
async getUint32(offset: bigint): Promise<number> {
|
|
45
|
+
return this.file.getUint32(toNumber(offset), true);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Gets an unsigned 64-bit integer at the specified byte offset from the start of the file.
|
|
50
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
51
|
+
*/
|
|
52
|
+
async getBigUint64(offset: bigint): Promise<bigint> {
|
|
53
|
+
return this.file.getBigUint64(toNumber(offset), true);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
|
|
58
|
+
* @param startOffset The offset, in bytes, from the start of the file where to start reading the data.
|
|
59
|
+
* @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
|
|
60
|
+
*/
|
|
61
|
+
async slice(startOffset: bigint, endOffset: bigint): Promise<ArrayBuffer> {
|
|
62
|
+
return this.file.buffer.slice(toNumber(startOffset), toNumber(endOffset));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** the length (in bytes) of the data. */
|
|
66
|
+
get length() {
|
|
67
|
+
return BigInt(this.file.byteLength);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {FileProvider} from './file-provider';
|
|
2
|
+
import {ZipSignature, searchFromTheEnd} from './search-from-the-end';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* End of central directory info
|
|
6
|
+
* according to https://en.wikipedia.org/wiki/ZIP_(file_format)
|
|
7
|
+
*/
|
|
8
|
+
export type ZipEoCDRecord = {
|
|
9
|
+
/** Relative offset of local file header */
|
|
10
|
+
cdStartOffset: bigint;
|
|
11
|
+
/** Relative offset of local file header */
|
|
12
|
+
cdRecordsNumber: bigint;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const eoCDSignature: ZipSignature = [0x50, 0x4b, 0x05, 0x06];
|
|
16
|
+
const zip64EoCDLocatorSignature = Buffer.from([0x50, 0x4b, 0x06, 0x07]);
|
|
17
|
+
const zip64EoCDSignature = Buffer.from([0x50, 0x4b, 0x06, 0x06]);
|
|
18
|
+
|
|
19
|
+
const offsets = {
|
|
20
|
+
CD_RECORDS_NUMBER_OFFSET: 8n,
|
|
21
|
+
CD_START_OFFSET_OFFSET: 16n,
|
|
22
|
+
|
|
23
|
+
ZIP64_EOCD_START_OFFSET_OFFSET: 8n,
|
|
24
|
+
|
|
25
|
+
ZIP64_CD_RECORDS_NUMBER_OFFSET: 24n,
|
|
26
|
+
ZIP64_CD_START_OFFSET_OFFSET: 48n
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Parses end of central directory record of zip file
|
|
31
|
+
* @param fileProvider - FileProvider instance
|
|
32
|
+
* @returns Info from the header
|
|
33
|
+
*/
|
|
34
|
+
export const parseEoCDRecord = async (fileProvider: FileProvider): Promise<ZipEoCDRecord> => {
|
|
35
|
+
const zipEoCDOffset = await searchFromTheEnd(fileProvider, eoCDSignature);
|
|
36
|
+
|
|
37
|
+
let cdRecordsNumber = BigInt(
|
|
38
|
+
await fileProvider.getUint16(zipEoCDOffset + offsets.CD_RECORDS_NUMBER_OFFSET)
|
|
39
|
+
);
|
|
40
|
+
let cdStartOffset = BigInt(
|
|
41
|
+
await fileProvider.getUint32(zipEoCDOffset + offsets.CD_START_OFFSET_OFFSET)
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
if (cdStartOffset === BigInt(0xffffffff) || cdRecordsNumber === BigInt(0xffffffff)) {
|
|
45
|
+
const zip64EoCDLocatorOffset = zipEoCDOffset - 20n;
|
|
46
|
+
|
|
47
|
+
if (
|
|
48
|
+
Buffer.from(
|
|
49
|
+
await fileProvider.slice(zip64EoCDLocatorOffset, zip64EoCDLocatorOffset + 4n)
|
|
50
|
+
).compare(zip64EoCDLocatorSignature) !== 0
|
|
51
|
+
) {
|
|
52
|
+
throw new Error('zip64 EoCD locator not found');
|
|
53
|
+
}
|
|
54
|
+
const zip64EoCDOffset = await fileProvider.getBigUint64(
|
|
55
|
+
zip64EoCDLocatorOffset + offsets.ZIP64_EOCD_START_OFFSET_OFFSET
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
if (
|
|
59
|
+
Buffer.from(await fileProvider.slice(zip64EoCDOffset, zip64EoCDOffset + 4n)).compare(
|
|
60
|
+
zip64EoCDSignature
|
|
61
|
+
) !== 0
|
|
62
|
+
) {
|
|
63
|
+
throw new Error('zip64 EoCD not found');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
cdRecordsNumber = await fileProvider.getBigUint64(
|
|
67
|
+
zip64EoCDOffset + offsets.ZIP64_CD_RECORDS_NUMBER_OFFSET
|
|
68
|
+
);
|
|
69
|
+
cdStartOffset = await fileProvider.getBigUint64(
|
|
70
|
+
zip64EoCDOffset + offsets.ZIP64_CD_START_OFFSET_OFFSET
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
cdRecordsNumber,
|
|
76
|
+
cdStartOffset
|
|
77
|
+
};
|
|
78
|
+
};
|
|
@@ -6,29 +6,35 @@ export interface FileProvider {
|
|
|
6
6
|
* Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
|
|
7
7
|
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
8
8
|
*/
|
|
9
|
-
getUint8(offset:
|
|
9
|
+
getUint8(offset: bigint): Promise<number>;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.
|
|
13
13
|
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
14
14
|
*/
|
|
15
|
-
getUint16(offset:
|
|
15
|
+
getUint16(offset: bigint): Promise<number>;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
19
19
|
* @param offset The offset, in bytes, from the file of the view where to read the data.
|
|
20
20
|
*/
|
|
21
|
-
getUint32(offset:
|
|
21
|
+
getUint32(offset: bigint): Promise<number>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
25
|
+
* @param offset The offset, in byte, from the file of the view where to read the data.
|
|
26
|
+
*/
|
|
27
|
+
getBigUint64(offset: bigint): Promise<bigint>;
|
|
22
28
|
|
|
23
29
|
/**
|
|
24
30
|
* returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
|
|
25
31
|
* @param startOffset The offset, in bytes, from the start of the file where to start reading the data.
|
|
26
32
|
* @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
|
|
27
33
|
*/
|
|
28
|
-
slice(startOffset:
|
|
34
|
+
slice(startOffset: bigint, endOffset: bigint): Promise<ArrayBuffer>;
|
|
29
35
|
|
|
30
36
|
/**
|
|
31
37
|
* the length (in bytes) of the data.
|
|
32
38
|
*/
|
|
33
|
-
length:
|
|
39
|
+
length: bigint;
|
|
34
40
|
}
|
|
@@ -12,19 +12,20 @@ export type ZipLocalFileHeader = {
|
|
|
12
12
|
/** Extra field length */
|
|
13
13
|
extraFieldLength: number;
|
|
14
14
|
/** Offset of the file data */
|
|
15
|
-
fileDataOffset:
|
|
15
|
+
fileDataOffset: bigint;
|
|
16
16
|
/** Compressed size */
|
|
17
|
-
compressedSize:
|
|
17
|
+
compressedSize: bigint;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
const offsets = {
|
|
21
|
-
COMPRESSED_SIZE_OFFSET:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
COMPRESSED_SIZE_OFFSET: 18n,
|
|
22
|
+
UNCOMPRESSED_SIZE_OFFSET: 22n,
|
|
23
|
+
FILE_NAME_LENGTH_OFFSET: 26n,
|
|
24
|
+
EXTRA_FIELD_LENGTH_OFFSET: 28n,
|
|
25
|
+
FILE_NAME_OFFSET: 30n
|
|
25
26
|
};
|
|
26
27
|
|
|
27
|
-
const signature = Buffer.from([0x50, 0x4b, 0x03, 0x04]);
|
|
28
|
+
export const signature = Buffer.from([0x50, 0x4b, 0x03, 0x04]);
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* Parses local file header of zip file
|
|
@@ -33,27 +34,52 @@ const signature = Buffer.from([0x50, 0x4b, 0x03, 0x04]);
|
|
|
33
34
|
* @returns Info from the header
|
|
34
35
|
*/
|
|
35
36
|
export const parseZipLocalFileHeader = async (
|
|
36
|
-
headerOffset:
|
|
37
|
+
headerOffset: bigint,
|
|
37
38
|
buffer: FileProvider
|
|
38
|
-
): Promise<ZipLocalFileHeader |
|
|
39
|
-
if (Buffer.from(await buffer.slice(headerOffset, headerOffset +
|
|
40
|
-
return
|
|
39
|
+
): Promise<ZipLocalFileHeader | null> => {
|
|
40
|
+
if (Buffer.from(await buffer.slice(headerOffset, headerOffset + 4n)).compare(signature) !== 0) {
|
|
41
|
+
return null;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
const fileNameLength = await buffer.getUint16(headerOffset + offsets.FILE_NAME_LENGTH_OFFSET);
|
|
44
45
|
|
|
45
|
-
const fileName = new TextDecoder()
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
const fileName = new TextDecoder()
|
|
47
|
+
.decode(
|
|
48
|
+
await buffer.slice(
|
|
49
|
+
headerOffset + offsets.FILE_NAME_OFFSET,
|
|
50
|
+
headerOffset + offsets.FILE_NAME_OFFSET + BigInt(fileNameLength)
|
|
51
|
+
)
|
|
49
52
|
)
|
|
50
|
-
|
|
53
|
+
.split('\\')
|
|
54
|
+
.join('/');
|
|
51
55
|
const extraFieldLength = await buffer.getUint16(headerOffset + offsets.EXTRA_FIELD_LENGTH_OFFSET);
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
headerOffset + offsets.FILE_NAME_OFFSET + fileNameLength + extraFieldLength;
|
|
57
|
+
let fileDataOffset =
|
|
58
|
+
headerOffset + offsets.FILE_NAME_OFFSET + BigInt(fileNameLength + extraFieldLength);
|
|
55
59
|
|
|
56
|
-
|
|
60
|
+
let compressedSize = BigInt(
|
|
61
|
+
await buffer.getUint32(headerOffset + offsets.COMPRESSED_SIZE_OFFSET)
|
|
62
|
+
); // add zip 64 logic
|
|
63
|
+
|
|
64
|
+
let uncompressedSize = BigInt(
|
|
65
|
+
await buffer.getUint32(headerOffset + offsets.UNCOMPRESSED_SIZE_OFFSET)
|
|
66
|
+
); // add zip 64 logic
|
|
67
|
+
|
|
68
|
+
const extraOffset = headerOffset + offsets.FILE_NAME_OFFSET + BigInt(fileNameLength);
|
|
69
|
+
|
|
70
|
+
let offsetInZip64Data = 4n;
|
|
71
|
+
// looking for info that might be also be in zip64 extra field
|
|
72
|
+
if (uncompressedSize === BigInt(0xffffffff)) {
|
|
73
|
+
uncompressedSize = await buffer.getBigUint64(extraOffset + offsetInZip64Data);
|
|
74
|
+
offsetInZip64Data += 8n;
|
|
75
|
+
}
|
|
76
|
+
if (compressedSize === BigInt(0xffffffff)) {
|
|
77
|
+
compressedSize = await buffer.getBigUint64(extraOffset + offsetInZip64Data);
|
|
78
|
+
offsetInZip64Data += 8n;
|
|
79
|
+
}
|
|
80
|
+
if (fileDataOffset === BigInt(0xffffffff)) {
|
|
81
|
+
fileDataOffset = await buffer.getBigUint64(extraOffset + offsetInZip64Data); // setting it to the one from zip64
|
|
82
|
+
}
|
|
57
83
|
|
|
58
84
|
return {
|
|
59
85
|
fileNameLength,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {FileProvider} from 'modules/i3s/src/lib/parsers/parse-zip/file-provider';
|
|
2
|
+
|
|
3
|
+
/** Description of zip signature type */
|
|
4
|
+
export type ZipSignature = [number, number, number, number];
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* looking for the last occurrence of the provided
|
|
8
|
+
* @param file
|
|
9
|
+
* @param target
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export const searchFromTheEnd = async (
|
|
13
|
+
file: FileProvider,
|
|
14
|
+
target: ZipSignature
|
|
15
|
+
): Promise<bigint> => {
|
|
16
|
+
const searchWindow = [
|
|
17
|
+
await file.getUint8(file.length - 1n),
|
|
18
|
+
await file.getUint8(file.length - 2n),
|
|
19
|
+
await file.getUint8(file.length - 3n),
|
|
20
|
+
undefined
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
let targetOffset = 0n;
|
|
24
|
+
|
|
25
|
+
// looking for the last record in the central directory
|
|
26
|
+
for (let i = file.length - 4n; i > -1; i--) {
|
|
27
|
+
searchWindow[3] = searchWindow[2];
|
|
28
|
+
searchWindow[2] = searchWindow[1];
|
|
29
|
+
searchWindow[1] = searchWindow[0];
|
|
30
|
+
searchWindow[0] = await file.getUint8(i);
|
|
31
|
+
if (searchWindow.every((val, index) => val === target[index])) {
|
|
32
|
+
targetOffset = i;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return targetOffset;
|
|
38
|
+
};
|
package/src/types.ts
CHANGED
|
@@ -2,18 +2,6 @@ import type {Matrix4, Quaternion, Vector3} from '@math.gl/core';
|
|
|
2
2
|
import type {TypedArray, MeshAttribute, TextureLevel} from '@loaders.gl/schema';
|
|
3
3
|
import {Tile3D, Tileset3D} from '@loaders.gl/tiles';
|
|
4
4
|
|
|
5
|
-
export enum DATA_TYPE {
|
|
6
|
-
UInt8 = 'UInt8',
|
|
7
|
-
UInt16 = 'UInt16',
|
|
8
|
-
UInt32 = 'UInt32',
|
|
9
|
-
UInt64 = 'UInt64',
|
|
10
|
-
Int16 = 'Int16',
|
|
11
|
-
Int32 = 'Int32',
|
|
12
|
-
Int64 = 'Int64',
|
|
13
|
-
Float32 = 'Float32',
|
|
14
|
-
Float64 = 'Float64'
|
|
15
|
-
}
|
|
16
|
-
|
|
17
5
|
export type COLOR = [number, number, number, number];
|
|
18
6
|
|
|
19
7
|
/**
|
|
@@ -690,20 +678,24 @@ type Domain = {
|
|
|
690
678
|
* spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/store.cmn.md
|
|
691
679
|
*/
|
|
692
680
|
type Store = {
|
|
693
|
-
id
|
|
681
|
+
id?: string | number;
|
|
694
682
|
profile: string;
|
|
695
683
|
version: number | string;
|
|
696
|
-
resourcePattern
|
|
697
|
-
rootNode
|
|
698
|
-
extent
|
|
699
|
-
indexCRS
|
|
700
|
-
vertexCRS
|
|
701
|
-
normalReferenceFrame
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
lodType: string;
|
|
705
|
-
lodModel: string;
|
|
684
|
+
resourcePattern?: string[];
|
|
685
|
+
rootNode?: string;
|
|
686
|
+
extent?: number[];
|
|
687
|
+
indexCRS?: string;
|
|
688
|
+
vertexCRS?: string;
|
|
689
|
+
normalReferenceFrame?: string;
|
|
690
|
+
lodType?: string;
|
|
691
|
+
lodModel?: string;
|
|
706
692
|
defaultGeometrySchema: DefaultGeometrySchema;
|
|
693
|
+
nidEncoding?: string;
|
|
694
|
+
textureEncoding?: string[];
|
|
695
|
+
featureEncoding?: string;
|
|
696
|
+
geometryEncoding?: string;
|
|
697
|
+
attributeEncoding?: string;
|
|
698
|
+
indexingScheme?: string;
|
|
707
699
|
};
|
|
708
700
|
/**
|
|
709
701
|
* Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/defaultGeometrySchema.cmn.md
|
|
@@ -726,15 +718,15 @@ type DefaultGeometrySchema = {
|
|
|
726
718
|
export type HeaderAttribute = {
|
|
727
719
|
property: HeaderAttributeProperty.vertexCount | HeaderAttributeProperty.featureCount | string;
|
|
728
720
|
type:
|
|
729
|
-
|
|
|
730
|
-
|
|
|
731
|
-
|
|
|
732
|
-
|
|
|
733
|
-
|
|
|
734
|
-
|
|
|
735
|
-
|
|
|
736
|
-
|
|
|
737
|
-
|
|
|
721
|
+
| 'UInt8'
|
|
722
|
+
| 'UInt16'
|
|
723
|
+
| 'UInt32'
|
|
724
|
+
| 'UInt64'
|
|
725
|
+
| 'Int16'
|
|
726
|
+
| 'Int32'
|
|
727
|
+
| 'Int64'
|
|
728
|
+
| 'Float32'
|
|
729
|
+
| 'Float64';
|
|
738
730
|
};
|
|
739
731
|
export enum HeaderAttributeProperty {
|
|
740
732
|
vertexCount = 'vertexCount',
|
|
@@ -749,14 +741,7 @@ export type VertexAttribute = {
|
|
|
749
741
|
};
|
|
750
742
|
export type GeometryAttribute = {
|
|
751
743
|
byteOffset?: number;
|
|
752
|
-
valueType:
|
|
753
|
-
| DATA_TYPE.UInt8
|
|
754
|
-
| DATA_TYPE.UInt16
|
|
755
|
-
| DATA_TYPE.Int16
|
|
756
|
-
| DATA_TYPE.Int32
|
|
757
|
-
| DATA_TYPE.Int64
|
|
758
|
-
| DATA_TYPE.Float32
|
|
759
|
-
| DATA_TYPE.Float64;
|
|
744
|
+
valueType: 'UInt8' | 'UInt16' | 'Int16' | 'Int32' | 'Int64' | 'Float32' | 'Float64';
|
|
760
745
|
valuesPerElement: number;
|
|
761
746
|
};
|
|
762
747
|
export type I3SMeshAttributes = {
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.DataViewFileProvider = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
var DataViewFileProvider = function () {
|
|
12
|
-
function DataViewFileProvider(file) {
|
|
13
|
-
(0, _classCallCheck2.default)(this, DataViewFileProvider);
|
|
14
|
-
(0, _defineProperty2.default)(this, "file", void 0);
|
|
15
|
-
this.file = file;
|
|
16
|
-
}
|
|
17
|
-
(0, _createClass2.default)(DataViewFileProvider, [{
|
|
18
|
-
key: "getUint8",
|
|
19
|
-
value: function getUint8(offset) {
|
|
20
|
-
return Promise.resolve(this.file.getUint8(offset));
|
|
21
|
-
}
|
|
22
|
-
}, {
|
|
23
|
-
key: "getUint16",
|
|
24
|
-
value: function getUint16(offset) {
|
|
25
|
-
return Promise.resolve(this.file.getUint16(offset, true));
|
|
26
|
-
}
|
|
27
|
-
}, {
|
|
28
|
-
key: "getUint32",
|
|
29
|
-
value: function getUint32(offset) {
|
|
30
|
-
return Promise.resolve(this.file.getUint32(offset, true));
|
|
31
|
-
}
|
|
32
|
-
}, {
|
|
33
|
-
key: "slice",
|
|
34
|
-
value: function slice(startOffset, endOffset) {
|
|
35
|
-
return Promise.resolve(this.file.buffer.slice(startOffset, endOffset));
|
|
36
|
-
}
|
|
37
|
-
}, {
|
|
38
|
-
key: "length",
|
|
39
|
-
get: function get() {
|
|
40
|
-
return this.file.byteLength;
|
|
41
|
-
}
|
|
42
|
-
}]);
|
|
43
|
-
return DataViewFileProvider;
|
|
44
|
-
}();
|
|
45
|
-
exports.DataViewFileProvider = DataViewFileProvider;
|
|
46
|
-
//# sourceMappingURL=buffer-file-provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-file-provider.js","names":["DataViewFileProvider","file","_classCallCheck2","default","_defineProperty2","_createClass2","key","value","getUint8","offset","Promise","resolve","getUint16","getUint32","slice","startOffset","endOffset","buffer","get","byteLength","exports"],"sources":["../../../../../src/lib/parsers/parse-zip/buffer-file-provider.ts"],"sourcesContent":["import {FileProvider} from './file-provider';\n\n/**\n * Provides file data using DataView\n */\nexport class DataViewFileProvider implements FileProvider {\n /**\n * The DataView from which data is provided\n */\n private file: DataView;\n\n constructor(file: DataView) {\n this.file = file;\n }\n\n /**\n * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n getUint8(offset: number): Promise<number> {\n return Promise.resolve(this.file.getUint8(offset));\n }\n\n /**\n * Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n getUint16(offset: number): Promise<number> {\n return Promise.resolve(this.file.getUint16(offset, true));\n }\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n getUint32(offset: number): Promise<number> {\n return Promise.resolve(this.file.getUint32(offset, true));\n }\n\n /**\n * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.\n * @param startOffset The offset, in bytes, from the start of the file where to start reading the data.\n * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.\n */\n slice(startOffset: number, endOffset: number): Promise<ArrayBuffer> {\n return Promise.resolve(this.file.buffer.slice(startOffset, endOffset));\n }\n\n /**\n * the length (in bytes) of the data.\n */\n get length() {\n return this.file.byteLength;\n }\n}\n"],"mappings":";;;;;;;;;;IAKaA,oBAAoB;EAM/B,SAAAA,qBAAYC,IAAc,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAH,oBAAA;IAAA,IAAAI,gBAAA,CAAAD,OAAA;IAC1B,IAAI,CAACF,IAAI,GAAGA,IAAI;EAClB;EAAC,IAAAI,aAAA,CAAAF,OAAA,EAAAH,oBAAA;IAAAM,GAAA;IAAAC,KAAA,EAMD,SAAAC,SAASC,MAAc,EAAmB;MACxC,OAAOC,OAAO,CAACC,OAAO,CAAC,IAAI,CAACV,IAAI,CAACO,QAAQ,CAACC,MAAM,CAAC,CAAC;IACpD;EAAC;IAAAH,GAAA;IAAAC,KAAA,EAMD,SAAAK,UAAUH,MAAc,EAAmB;MACzC,OAAOC,OAAO,CAACC,OAAO,CAAC,IAAI,CAACV,IAAI,CAACW,SAAS,CAACH,MAAM,EAAE,IAAI,CAAC,CAAC;IAC3D;EAAC;IAAAH,GAAA;IAAAC,KAAA,EAMD,SAAAM,UAAUJ,MAAc,EAAmB;MACzC,OAAOC,OAAO,CAACC,OAAO,CAAC,IAAI,CAACV,IAAI,CAACY,SAAS,CAACJ,MAAM,EAAE,IAAI,CAAC,CAAC;IAC3D;EAAC;IAAAH,GAAA;IAAAC,KAAA,EAOD,SAAAO,MAAMC,WAAmB,EAAEC,SAAiB,EAAwB;MAClE,OAAON,OAAO,CAACC,OAAO,CAAC,IAAI,CAACV,IAAI,CAACgB,MAAM,CAACH,KAAK,CAACC,WAAW,EAAEC,SAAS,CAAC,CAAC;IACxE;EAAC;IAAAV,GAAA;IAAAY,GAAA,EAKD,SAAAA,IAAA,EAAa;MACX,OAAO,IAAI,CAACjB,IAAI,CAACkB,UAAU;IAC7B;EAAC;EAAA,OAAAnB,oBAAA;AAAA;AAAAoB,OAAA,CAAApB,oBAAA,GAAAA,oBAAA"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
export class DataViewFileProvider {
|
|
3
|
-
constructor(file) {
|
|
4
|
-
_defineProperty(this, "file", void 0);
|
|
5
|
-
this.file = file;
|
|
6
|
-
}
|
|
7
|
-
getUint8(offset) {
|
|
8
|
-
return Promise.resolve(this.file.getUint8(offset));
|
|
9
|
-
}
|
|
10
|
-
getUint16(offset) {
|
|
11
|
-
return Promise.resolve(this.file.getUint16(offset, true));
|
|
12
|
-
}
|
|
13
|
-
getUint32(offset) {
|
|
14
|
-
return Promise.resolve(this.file.getUint32(offset, true));
|
|
15
|
-
}
|
|
16
|
-
slice(startOffset, endOffset) {
|
|
17
|
-
return Promise.resolve(this.file.buffer.slice(startOffset, endOffset));
|
|
18
|
-
}
|
|
19
|
-
get length() {
|
|
20
|
-
return this.file.byteLength;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=buffer-file-provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-file-provider.js","names":["DataViewFileProvider","constructor","file","_defineProperty","getUint8","offset","Promise","resolve","getUint16","getUint32","slice","startOffset","endOffset","buffer","length","byteLength"],"sources":["../../../../../src/lib/parsers/parse-zip/buffer-file-provider.ts"],"sourcesContent":["import {FileProvider} from './file-provider';\n\n/**\n * Provides file data using DataView\n */\nexport class DataViewFileProvider implements FileProvider {\n /**\n * The DataView from which data is provided\n */\n private file: DataView;\n\n constructor(file: DataView) {\n this.file = file;\n }\n\n /**\n * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n getUint8(offset: number): Promise<number> {\n return Promise.resolve(this.file.getUint8(offset));\n }\n\n /**\n * Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n getUint16(offset: number): Promise<number> {\n return Promise.resolve(this.file.getUint16(offset, true));\n }\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n getUint32(offset: number): Promise<number> {\n return Promise.resolve(this.file.getUint32(offset, true));\n }\n\n /**\n * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.\n * @param startOffset The offset, in bytes, from the start of the file where to start reading the data.\n * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.\n */\n slice(startOffset: number, endOffset: number): Promise<ArrayBuffer> {\n return Promise.resolve(this.file.buffer.slice(startOffset, endOffset));\n }\n\n /**\n * the length (in bytes) of the data.\n */\n get length() {\n return this.file.byteLength;\n }\n}\n"],"mappings":";AAKA,OAAO,MAAMA,oBAAoB,CAAyB;EAMxDC,WAAWA,CAACC,IAAc,EAAE;IAAAC,eAAA;IAC1B,IAAI,CAACD,IAAI,GAAGA,IAAI;EAClB;EAMAE,QAAQA,CAACC,MAAc,EAAmB;IACxC,OAAOC,OAAO,CAACC,OAAO,CAAC,IAAI,CAACL,IAAI,CAACE,QAAQ,CAACC,MAAM,CAAC,CAAC;EACpD;EAMAG,SAASA,CAACH,MAAc,EAAmB;IACzC,OAAOC,OAAO,CAACC,OAAO,CAAC,IAAI,CAACL,IAAI,CAACM,SAAS,CAACH,MAAM,EAAE,IAAI,CAAC,CAAC;EAC3D;EAMAI,SAASA,CAACJ,MAAc,EAAmB;IACzC,OAAOC,OAAO,CAACC,OAAO,CAAC,IAAI,CAACL,IAAI,CAACO,SAAS,CAACJ,MAAM,EAAE,IAAI,CAAC,CAAC;EAC3D;EAOAK,KAAKA,CAACC,WAAmB,EAAEC,SAAiB,EAAwB;IAClE,OAAON,OAAO,CAACC,OAAO,CAAC,IAAI,CAACL,IAAI,CAACW,MAAM,CAACH,KAAK,CAACC,WAAW,EAAEC,SAAS,CAAC,CAAC;EACxE;EAKA,IAAIE,MAAMA,CAAA,EAAG;IACX,OAAO,IAAI,CAACZ,IAAI,CAACa,UAAU;EAC7B;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-file-provider.d.ts","sourceRoot":"","sources":["../../../../src/lib/parsers/parse-zip/buffer-file-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C;;GAEG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IACvD;;OAEG;IACH,OAAO,CAAC,IAAI,CAAW;gBAEX,IAAI,EAAE,QAAQ;IAI1B;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzC;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1C;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1C;;;;OAIG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAInE;;OAEG;IACH,IAAI,MAAM,WAET;CACF"}
|