@loaders.gl/tile-converter 4.0.0-alpha.20 → 4.0.0-alpha.21

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.
Files changed (47) hide show
  1. package/dist/converter.min.js +15 -15
  2. package/dist/dist.min.js +31819 -31901
  3. package/dist/es5/deps-installer/deps-installer.js +1 -1
  4. package/dist/es5/i3s-server/controllers/slpk-controller.js +2 -2
  5. package/dist/es5/i3s-server/controllers/slpk-controller.js.map +1 -1
  6. package/dist/es5/index.js +0 -7
  7. package/dist/es5/index.js.map +1 -1
  8. package/dist/es5/pgm-loader.js +1 -1
  9. package/dist/es5/slpk-extractor/slpk-extractor.js +7 -8
  10. package/dist/es5/slpk-extractor/slpk-extractor.js.map +1 -1
  11. package/dist/esm/deps-installer/deps-installer.js +1 -1
  12. package/dist/esm/i3s-server/bin/i3s-server.min.js +70 -70
  13. package/dist/esm/i3s-server/controllers/slpk-controller.js +1 -1
  14. package/dist/esm/i3s-server/controllers/slpk-controller.js.map +1 -1
  15. package/dist/esm/index.js +0 -1
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/pgm-loader.js +1 -1
  18. package/dist/esm/slpk-extractor/slpk-extractor.js +2 -3
  19. package/dist/esm/slpk-extractor/slpk-extractor.js.map +1 -1
  20. package/dist/i3s-server/controllers/slpk-controller.js +2 -2
  21. package/dist/index.d.ts +0 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +1 -3
  24. package/dist/slpk-extractor/slpk-extractor.d.ts +1 -1
  25. package/dist/slpk-extractor/slpk-extractor.d.ts.map +1 -1
  26. package/dist/slpk-extractor/slpk-extractor.js +3 -4
  27. package/dist/slpk-extractor.min.js +35 -35
  28. package/package.json +14 -14
  29. package/src/i3s-server/controllers/slpk-controller.ts +1 -1
  30. package/src/index.ts +0 -1
  31. package/src/slpk-extractor/slpk-extractor.ts +2 -3
  32. package/dist/es5/slpk-extractor/helpers/file-handle-file.js +0 -214
  33. package/dist/es5/slpk-extractor/helpers/file-handle-file.js.map +0 -1
  34. package/dist/es5/slpk-extractor/helpers/fs-promises.js +0 -77
  35. package/dist/es5/slpk-extractor/helpers/fs-promises.js.map +0 -1
  36. package/dist/esm/slpk-extractor/helpers/file-handle-file.js +0 -54
  37. package/dist/esm/slpk-extractor/helpers/file-handle-file.js.map +0 -1
  38. package/dist/esm/slpk-extractor/helpers/fs-promises.js +0 -32
  39. package/dist/esm/slpk-extractor/helpers/fs-promises.js.map +0 -1
  40. package/dist/slpk-extractor/helpers/file-handle-file.d.ts +0 -51
  41. package/dist/slpk-extractor/helpers/file-handle-file.d.ts.map +0 -1
  42. package/dist/slpk-extractor/helpers/file-handle-file.js +0 -86
  43. package/dist/slpk-extractor/helpers/fs-promises.d.ts +0 -38
  44. package/dist/slpk-extractor/helpers/fs-promises.d.ts.map +0 -1
  45. package/dist/slpk-extractor/helpers/fs-promises.js +0 -51
  46. package/src/slpk-extractor/helpers/file-handle-file.ts +0 -109
  47. package/src/slpk-extractor/helpers/fs-promises.ts +0 -66
@@ -1,86 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FileHandleFile = void 0;
4
- const fs_promises_1 = require("./fs-promises");
5
- /**
6
- * Provides file data using node fs library
7
- */
8
- class FileHandleFile {
9
- /**
10
- * Returns a new copy of FileHandleFile
11
- * @param path The path to the file in file system
12
- */
13
- static async from(path) {
14
- const fileDescriptor = await fs_promises_1.FileHandle.open(path);
15
- return new FileHandleFile(fileDescriptor, fileDescriptor.stat.size);
16
- }
17
- constructor(fileDescriptor, size) {
18
- this.fileDescriptor = fileDescriptor;
19
- this.size = size;
20
- }
21
- /**
22
- * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
23
- * @param offset The offset, in bytes, from the start of the file where to read the data.
24
- */
25
- async getUint8(offset) {
26
- const val = new Uint8Array((await this.fileDescriptor.read(Buffer.alloc(1), 0, 1, offset)).buffer.buffer).at(0);
27
- if (val === undefined) {
28
- throw new Error('something went wrong');
29
- }
30
- return val;
31
- }
32
- /**
33
- * Gets an unsigned 16-bit integer 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) {
37
- const val = new Uint16Array((await this.fileDescriptor.read(Buffer.alloc(2), 0, 2, offset)).buffer.buffer).at(0);
38
- if (val === undefined) {
39
- throw new Error('something went wrong');
40
- }
41
- return val;
42
- }
43
- /**
44
- * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
45
- * @param offset The offset, in bytes, from the start of the file where to read the data.
46
- */
47
- async getUint32(offset) {
48
- const val = new Uint32Array((await this.fileDescriptor.read(Buffer.alloc(4), 0, 4, offset)).buffer.buffer).at(0);
49
- if (val === undefined) {
50
- throw new Error('something went wrong');
51
- }
52
- return val;
53
- }
54
- /**
55
- * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
56
- * @param offset The offset, in bytes, from the start of the file where to read the data.
57
- */
58
- async getBigUint64(offset) {
59
- const val = new BigInt64Array((await this.fileDescriptor.read(Buffer.alloc(8), 0, 8, offset)).buffer.buffer).at(0);
60
- if (val === undefined) {
61
- throw new Error('something went wrong');
62
- }
63
- return val;
64
- }
65
- /**
66
- * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
67
- * @param startOffsset The offset, in byte, from the start of the file where to start reading the data.
68
- * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
69
- */
70
- async slice(startOffsset, endOffset) {
71
- const bigLength = endOffset - startOffsset;
72
- if (bigLength > Number.MAX_SAFE_INTEGER) {
73
- throw new Error('too big slice');
74
- }
75
- const length = Number(bigLength);
76
- return (await this.fileDescriptor.read(Buffer.alloc(length), 0, length, startOffsset)).buffer
77
- .buffer;
78
- }
79
- /**
80
- * the length (in bytes) of the data.
81
- */
82
- get length() {
83
- return this.size;
84
- }
85
- }
86
- exports.FileHandleFile = FileHandleFile;
@@ -1,38 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { BigIntStats } from 'fs';
4
- /** file reading result */
5
- export type FileReadResult = {
6
- /** amount of the bytes read */
7
- bytesRead: number;
8
- /** the buffer filled with data from file*/
9
- buffer: Buffer;
10
- };
11
- /** Object handling file info */
12
- export declare class FileHandle {
13
- private fileDescriptor;
14
- private stats;
15
- private constructor();
16
- /**
17
- * Opens a `FileHandle`.
18
- *
19
- * @param path path to the file
20
- * @return Fulfills with a {FileHandle} object.
21
- */
22
- static open: (path: string) => Promise<FileHandle>;
23
- /**
24
- * Reads data from the file and stores that in the given buffer.
25
- *
26
- * If the file is not modified concurrently, the end-of-file is reached when the
27
- * number of bytes read is zero.
28
- * @param buffer A buffer that will be filled with the file data read.
29
- * @param offset The location in the buffer at which to start filling.
30
- * @param length The number of bytes to read.
31
- * @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an
32
- * integer, the current file position will remain unchanged.
33
- * @return Fulfills upon success with a FileReadResult object
34
- */
35
- read: (buffer: Buffer, offset: number, length: number, position: number | bigint) => Promise<FileReadResult>;
36
- get stat(): BigIntStats;
37
- }
38
- //# sourceMappingURL=fs-promises.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fs-promises.d.ts","sourceRoot":"","sources":["../../../src/slpk-extractor/helpers/fs-promises.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAmB,WAAW,EAAC,MAAM,IAAI,CAAC;AAEjD,0BAA0B;AAC1B,MAAM,MAAM,cAAc,GAAG;IAC3B,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,gCAAgC;AAChC,qBAAa,UAAU;IACrB,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO;IAIP;;;;;OAKG;IAEH,MAAM,CAAC,IAAI,SAAgB,MAAM,KAAG,QAAQ,UAAU,CAAC,CAUrD;IAEF;;;;;;;;;;;OAWG;IACH,IAAI,WACM,MAAM,UACN,MAAM,UACN,MAAM,YACJ,MAAM,GAAG,MAAM,KACxB,QAAQ,cAAc,CAAC,CAMxB;IAEF,IAAI,IAAI,IAAI,WAAW,CAEtB;CACF"}
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.FileHandle = void 0;
5
- const fs_1 = require("fs");
6
- /** Object handling file info */
7
- class FileHandle {
8
- constructor(fileDescriptor, stats) {
9
- /**
10
- * Reads data from the file and stores that in the given buffer.
11
- *
12
- * If the file is not modified concurrently, the end-of-file is reached when the
13
- * number of bytes read is zero.
14
- * @param buffer A buffer that will be filled with the file data read.
15
- * @param offset The location in the buffer at which to start filling.
16
- * @param length The number of bytes to read.
17
- * @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an
18
- * integer, the current file position will remain unchanged.
19
- * @return Fulfills upon success with a FileReadResult object
20
- */
21
- this.read = (buffer, offset, length, position) => {
22
- return new Promise((s) => {
23
- (0, fs_1.read)(this.fileDescriptor, buffer, offset, length, position, (_err, bytesRead, buffer) => s({ bytesRead, buffer }));
24
- });
25
- };
26
- this.fileDescriptor = fileDescriptor;
27
- this.stats = stats;
28
- }
29
- get stat() {
30
- return this.stats;
31
- }
32
- }
33
- exports.FileHandle = FileHandle;
34
- _a = FileHandle;
35
- /**
36
- * Opens a `FileHandle`.
37
- *
38
- * @param path path to the file
39
- * @return Fulfills with a {FileHandle} object.
40
- */
41
- FileHandle.open = async (path) => {
42
- const [fd, stats] = await Promise.all([
43
- new Promise((s) => {
44
- (0, fs_1.open)(path, undefined, undefined, (_err, fd) => s(fd));
45
- }),
46
- new Promise((s) => {
47
- (0, fs_1.stat)(path, { bigint: true }, (_err, stats) => s(stats));
48
- })
49
- ]);
50
- return new FileHandle(fd, stats);
51
- };
@@ -1,109 +0,0 @@
1
- import {FileProvider} from '@loaders.gl/zip';
2
- import {FileHandle} from './fs-promises';
3
-
4
- /**
5
- * Provides file data using node fs library
6
- */
7
- export class FileHandleFile implements FileProvider {
8
- /**
9
- * Returns a new copy of FileHandleFile
10
- * @param path The path to the file in file system
11
- */
12
- static async from(path: string): Promise<FileHandleFile> {
13
- const fileDescriptor = await FileHandle.open(path);
14
- return new FileHandleFile(fileDescriptor, fileDescriptor.stat.size);
15
- }
16
-
17
- /**
18
- * The FileHandle from which data is provided
19
- */
20
- private fileDescriptor: FileHandle;
21
-
22
- /**
23
- * The file length in bytes
24
- */
25
- private size: bigint;
26
-
27
- private constructor(fileDescriptor: FileHandle, size: bigint) {
28
- this.fileDescriptor = fileDescriptor;
29
- this.size = size;
30
- }
31
-
32
- /**
33
- * Gets an unsigned 8-bit integer 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 getUint8(offset: bigint): Promise<number> {
37
- const val = new Uint8Array(
38
- (await this.fileDescriptor.read(Buffer.alloc(1), 0, 1, offset)).buffer.buffer
39
- ).at(0);
40
- if (val === undefined) {
41
- throw new Error('something went wrong');
42
- }
43
- return val;
44
- }
45
-
46
- /**
47
- * Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.
48
- * @param offset The offset, in bytes, from the start of the file where to read the data.
49
- */
50
- async getUint16(offset: bigint): Promise<number> {
51
- const val = new Uint16Array(
52
- (await this.fileDescriptor.read(Buffer.alloc(2), 0, 2, offset)).buffer.buffer
53
- ).at(0);
54
- if (val === undefined) {
55
- throw new Error('something went wrong');
56
- }
57
- return val;
58
- }
59
-
60
- /**
61
- * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
62
- * @param offset The offset, in bytes, from the start of the file where to read the data.
63
- */
64
- async getUint32(offset: bigint): Promise<number> {
65
- const val = new Uint32Array(
66
- (await this.fileDescriptor.read(Buffer.alloc(4), 0, 4, offset)).buffer.buffer
67
- ).at(0);
68
- if (val === undefined) {
69
- throw new Error('something went wrong');
70
- }
71
- return val;
72
- }
73
-
74
- /**
75
- * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
76
- * @param offset The offset, in bytes, from the start of the file where to read the data.
77
- */
78
- async getBigUint64(offset: bigint): Promise<bigint> {
79
- const val = new BigInt64Array(
80
- (await this.fileDescriptor.read(Buffer.alloc(8), 0, 8, offset)).buffer.buffer
81
- ).at(0);
82
- if (val === undefined) {
83
- throw new Error('something went wrong');
84
- }
85
- return val;
86
- }
87
-
88
- /**
89
- * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
90
- * @param startOffsset The offset, in byte, from the start of the file where to start reading the data.
91
- * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
92
- */
93
- async slice(startOffsset: bigint, endOffset: bigint): Promise<ArrayBuffer> {
94
- const bigLength = endOffset - startOffsset;
95
- if (bigLength > Number.MAX_SAFE_INTEGER) {
96
- throw new Error('too big slice');
97
- }
98
- const length = Number(bigLength);
99
- return (await this.fileDescriptor.read(Buffer.alloc(length), 0, length, startOffsset)).buffer
100
- .buffer;
101
- }
102
-
103
- /**
104
- * the length (in bytes) of the data.
105
- */
106
- get length(): bigint {
107
- return this.size;
108
- }
109
- }
@@ -1,66 +0,0 @@
1
- import {read, open, stat, BigIntStats} from 'fs';
2
-
3
- /** file reading result */
4
- export type FileReadResult = {
5
- /** amount of the bytes read */
6
- bytesRead: number;
7
- /** the buffer filled with data from file*/
8
- buffer: Buffer;
9
- };
10
-
11
- /** Object handling file info */
12
- export class FileHandle {
13
- private fileDescriptor: number;
14
- private stats: BigIntStats;
15
- private constructor(fileDescriptor: number, stats: BigIntStats) {
16
- this.fileDescriptor = fileDescriptor;
17
- this.stats = stats;
18
- }
19
- /**
20
- * Opens a `FileHandle`.
21
- *
22
- * @param path path to the file
23
- * @return Fulfills with a {FileHandle} object.
24
- */
25
-
26
- static open = async (path: string): Promise<FileHandle> => {
27
- const [fd, stats] = await Promise.all([
28
- new Promise<number>((s) => {
29
- open(path, undefined, undefined, (_err, fd) => s(fd));
30
- }),
31
- new Promise<BigIntStats>((s) => {
32
- stat(path, {bigint: true}, (_err, stats) => s(stats));
33
- })
34
- ]);
35
- return new FileHandle(fd, stats);
36
- };
37
-
38
- /**
39
- * Reads data from the file and stores that in the given buffer.
40
- *
41
- * If the file is not modified concurrently, the end-of-file is reached when the
42
- * number of bytes read is zero.
43
- * @param buffer A buffer that will be filled with the file data read.
44
- * @param offset The location in the buffer at which to start filling.
45
- * @param length The number of bytes to read.
46
- * @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an
47
- * integer, the current file position will remain unchanged.
48
- * @return Fulfills upon success with a FileReadResult object
49
- */
50
- read = (
51
- buffer: Buffer,
52
- offset: number,
53
- length: number,
54
- position: number | bigint
55
- ): Promise<FileReadResult> => {
56
- return new Promise((s) => {
57
- read(this.fileDescriptor, buffer, offset, length, position, (_err, bytesRead, buffer) =>
58
- s({bytesRead, buffer})
59
- );
60
- });
61
- };
62
-
63
- get stat(): BigIntStats {
64
- return this.stats;
65
- }
66
- }