@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/tile-converter",
3
- "version": "4.0.0-alpha.20",
3
+ "version": "4.0.0-alpha.21",
4
4
  "description": "Converter",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -45,18 +45,18 @@
45
45
  "build-i3s-server-bundle": "esbuild src/i3s-server/bin/www.ts --outfile=dist/esm/i3s-server/bin/i3s-server.min.js --platform=node --target=esnext,node14 --external:join-images --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\""
46
46
  },
47
47
  "dependencies": {
48
- "@loaders.gl/3d-tiles": "4.0.0-alpha.20",
49
- "@loaders.gl/crypto": "4.0.0-alpha.20",
50
- "@loaders.gl/draco": "4.0.0-alpha.20",
51
- "@loaders.gl/gltf": "4.0.0-alpha.20",
52
- "@loaders.gl/i3s": "4.0.0-alpha.20",
53
- "@loaders.gl/images": "4.0.0-alpha.20",
54
- "@loaders.gl/loader-utils": "4.0.0-alpha.20",
55
- "@loaders.gl/polyfills": "4.0.0-alpha.20",
56
- "@loaders.gl/textures": "4.0.0-alpha.20",
57
- "@loaders.gl/tiles": "4.0.0-alpha.20",
58
- "@loaders.gl/worker-utils": "4.0.0-alpha.20",
59
- "@loaders.gl/zip": "4.0.0-alpha.20",
48
+ "@loaders.gl/3d-tiles": "4.0.0-alpha.21",
49
+ "@loaders.gl/crypto": "4.0.0-alpha.21",
50
+ "@loaders.gl/draco": "4.0.0-alpha.21",
51
+ "@loaders.gl/gltf": "4.0.0-alpha.21",
52
+ "@loaders.gl/i3s": "4.0.0-alpha.21",
53
+ "@loaders.gl/images": "4.0.0-alpha.21",
54
+ "@loaders.gl/loader-utils": "4.0.0-alpha.21",
55
+ "@loaders.gl/polyfills": "4.0.0-alpha.21",
56
+ "@loaders.gl/textures": "4.0.0-alpha.21",
57
+ "@loaders.gl/tiles": "4.0.0-alpha.21",
58
+ "@loaders.gl/worker-utils": "4.0.0-alpha.21",
59
+ "@loaders.gl/zip": "4.0.0-alpha.21",
60
60
  "@math.gl/core": "^3.5.1",
61
61
  "@math.gl/culling": "^3.5.1",
62
62
  "@math.gl/geoid": "^3.5.1",
@@ -80,7 +80,7 @@
80
80
  "join-images": "^1.1.3",
81
81
  "sharp": "^0.31.3"
82
82
  },
83
- "gitHead": "ac122e83102657c38207d59c631a5ce4e7aa46bd",
83
+ "gitHead": "df5d670b136192b26941396e944f9c46be788e83",
84
84
  "devDependencies": {
85
85
  "@types/express": "^4.17.17",
86
86
  "@types/node": "^20.4.2"
@@ -1,6 +1,6 @@
1
1
  import '@loaders.gl/polyfills';
2
2
  import {parseSLPK} from '@loaders.gl/i3s';
3
- import {FileHandleFile} from '@loaders.gl/tile-converter';
3
+ import {FileHandleFile} from '@loaders.gl/zip';
4
4
 
5
5
  let slpkArchive;
6
6
 
package/src/index.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export {default as I3SConverter} from './i3s-converter/i3s-converter';
2
2
  export {default as Tiles3DConverter} from './3d-tiles-converter/3d-tiles-converter';
3
- export {FileHandleFile} from './slpk-extractor/helpers/file-handle-file';
@@ -1,9 +1,8 @@
1
1
  import {isBrowser} from '@loaders.gl/core';
2
2
 
3
3
  import {BROWSER_ERROR_MESSAGE} from '../constants';
4
- import {FileHandleFile} from './helpers/file-handle-file';
5
4
  import {path} from '@loaders.gl/loader-utils';
6
- import {parseZipLocalFileHeader} from '@loaders.gl/zip';
5
+ import {FileHandleFile, parseZipLocalFileHeader} from '@loaders.gl/zip';
7
6
  import {GZipCompression} from '@loaders.gl/compression';
8
7
  import {writeFile} from '../lib/utils/file-utils';
9
8
 
@@ -24,7 +23,7 @@ type File = {
24
23
  /**
25
24
  * Converter from slpk to i3s
26
25
  */
27
- export default class SLPKConverter {
26
+ export default class SLPKExtractor {
28
27
  /**
29
28
  * Extract slpk to i3s
30
29
  * @param options
@@ -1,214 +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.FileHandleFile = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
- var _fsPromises = require("./fs-promises");
14
- var FileHandleFile = function () {
15
- function FileHandleFile(fileDescriptor, size) {
16
- (0, _classCallCheck2.default)(this, FileHandleFile);
17
- (0, _defineProperty2.default)(this, "fileDescriptor", void 0);
18
- (0, _defineProperty2.default)(this, "size", void 0);
19
- this.fileDescriptor = fileDescriptor;
20
- this.size = size;
21
- }
22
- (0, _createClass2.default)(FileHandleFile, [{
23
- key: "getUint8",
24
- value: function () {
25
- var _getUint = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(offset) {
26
- var val;
27
- return _regenerator.default.wrap(function _callee$(_context) {
28
- while (1) switch (_context.prev = _context.next) {
29
- case 0:
30
- _context.t0 = Uint8Array;
31
- _context.next = 3;
32
- return this.fileDescriptor.read(Buffer.alloc(1), 0, 1, offset);
33
- case 3:
34
- _context.t1 = _context.sent.buffer.buffer;
35
- val = new _context.t0(_context.t1).at(0);
36
- if (!(val === undefined)) {
37
- _context.next = 7;
38
- break;
39
- }
40
- throw new Error('something went wrong');
41
- case 7:
42
- return _context.abrupt("return", val);
43
- case 8:
44
- case "end":
45
- return _context.stop();
46
- }
47
- }, _callee, this);
48
- }));
49
- function getUint8(_x) {
50
- return _getUint.apply(this, arguments);
51
- }
52
- return getUint8;
53
- }()
54
- }, {
55
- key: "getUint16",
56
- value: function () {
57
- var _getUint2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(offset) {
58
- var val;
59
- return _regenerator.default.wrap(function _callee2$(_context2) {
60
- while (1) switch (_context2.prev = _context2.next) {
61
- case 0:
62
- _context2.t0 = Uint16Array;
63
- _context2.next = 3;
64
- return this.fileDescriptor.read(Buffer.alloc(2), 0, 2, offset);
65
- case 3:
66
- _context2.t1 = _context2.sent.buffer.buffer;
67
- val = new _context2.t0(_context2.t1).at(0);
68
- if (!(val === undefined)) {
69
- _context2.next = 7;
70
- break;
71
- }
72
- throw new Error('something went wrong');
73
- case 7:
74
- return _context2.abrupt("return", val);
75
- case 8:
76
- case "end":
77
- return _context2.stop();
78
- }
79
- }, _callee2, this);
80
- }));
81
- function getUint16(_x2) {
82
- return _getUint2.apply(this, arguments);
83
- }
84
- return getUint16;
85
- }()
86
- }, {
87
- key: "getUint32",
88
- value: function () {
89
- var _getUint3 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(offset) {
90
- var val;
91
- return _regenerator.default.wrap(function _callee3$(_context3) {
92
- while (1) switch (_context3.prev = _context3.next) {
93
- case 0:
94
- _context3.t0 = Uint32Array;
95
- _context3.next = 3;
96
- return this.fileDescriptor.read(Buffer.alloc(4), 0, 4, offset);
97
- case 3:
98
- _context3.t1 = _context3.sent.buffer.buffer;
99
- val = new _context3.t0(_context3.t1).at(0);
100
- if (!(val === undefined)) {
101
- _context3.next = 7;
102
- break;
103
- }
104
- throw new Error('something went wrong');
105
- case 7:
106
- return _context3.abrupt("return", val);
107
- case 8:
108
- case "end":
109
- return _context3.stop();
110
- }
111
- }, _callee3, this);
112
- }));
113
- function getUint32(_x3) {
114
- return _getUint3.apply(this, arguments);
115
- }
116
- return getUint32;
117
- }()
118
- }, {
119
- key: "getBigUint64",
120
- value: function () {
121
- var _getBigUint = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4(offset) {
122
- var val;
123
- return _regenerator.default.wrap(function _callee4$(_context4) {
124
- while (1) switch (_context4.prev = _context4.next) {
125
- case 0:
126
- _context4.t0 = BigInt64Array;
127
- _context4.next = 3;
128
- return this.fileDescriptor.read(Buffer.alloc(8), 0, 8, offset);
129
- case 3:
130
- _context4.t1 = _context4.sent.buffer.buffer;
131
- val = new _context4.t0(_context4.t1).at(0);
132
- if (!(val === undefined)) {
133
- _context4.next = 7;
134
- break;
135
- }
136
- throw new Error('something went wrong');
137
- case 7:
138
- return _context4.abrupt("return", val);
139
- case 8:
140
- case "end":
141
- return _context4.stop();
142
- }
143
- }, _callee4, this);
144
- }));
145
- function getBigUint64(_x4) {
146
- return _getBigUint.apply(this, arguments);
147
- }
148
- return getBigUint64;
149
- }()
150
- }, {
151
- key: "slice",
152
- value: function () {
153
- var _slice = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee5(startOffsset, endOffset) {
154
- var bigLength, length;
155
- return _regenerator.default.wrap(function _callee5$(_context5) {
156
- while (1) switch (_context5.prev = _context5.next) {
157
- case 0:
158
- bigLength = endOffset - startOffsset;
159
- if (!(bigLength > Number.MAX_SAFE_INTEGER)) {
160
- _context5.next = 3;
161
- break;
162
- }
163
- throw new Error('too big slice');
164
- case 3:
165
- length = Number(bigLength);
166
- _context5.next = 6;
167
- return this.fileDescriptor.read(Buffer.alloc(length), 0, length, startOffsset);
168
- case 6:
169
- return _context5.abrupt("return", _context5.sent.buffer.buffer);
170
- case 7:
171
- case "end":
172
- return _context5.stop();
173
- }
174
- }, _callee5, this);
175
- }));
176
- function slice(_x5, _x6) {
177
- return _slice.apply(this, arguments);
178
- }
179
- return slice;
180
- }()
181
- }, {
182
- key: "length",
183
- get: function get() {
184
- return this.size;
185
- }
186
- }], [{
187
- key: "from",
188
- value: function () {
189
- var _from = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee6(path) {
190
- var fileDescriptor;
191
- return _regenerator.default.wrap(function _callee6$(_context6) {
192
- while (1) switch (_context6.prev = _context6.next) {
193
- case 0:
194
- _context6.next = 2;
195
- return _fsPromises.FileHandle.open(path);
196
- case 2:
197
- fileDescriptor = _context6.sent;
198
- return _context6.abrupt("return", new FileHandleFile(fileDescriptor, fileDescriptor.stat.size));
199
- case 4:
200
- case "end":
201
- return _context6.stop();
202
- }
203
- }, _callee6);
204
- }));
205
- function from(_x7) {
206
- return _from.apply(this, arguments);
207
- }
208
- return from;
209
- }()
210
- }]);
211
- return FileHandleFile;
212
- }();
213
- exports.FileHandleFile = FileHandleFile;
214
- //# sourceMappingURL=file-handle-file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-handle-file.js","names":["_fsPromises","require","FileHandleFile","fileDescriptor","size","_classCallCheck2","default","_defineProperty2","_createClass2","key","value","_getUint","_asyncToGenerator2","_regenerator","mark","_callee","offset","val","wrap","_callee$","_context","prev","next","t0","Uint8Array","read","Buffer","alloc","t1","sent","buffer","at","undefined","Error","abrupt","stop","getUint8","_x","apply","arguments","_getUint2","_callee2","_callee2$","_context2","Uint16Array","getUint16","_x2","_getUint3","_callee3","_callee3$","_context3","Uint32Array","getUint32","_x3","_getBigUint","_callee4","_callee4$","_context4","BigInt64Array","getBigUint64","_x4","_slice","_callee5","startOffsset","endOffset","bigLength","length","_callee5$","_context5","Number","MAX_SAFE_INTEGER","slice","_x5","_x6","get","_from","_callee6","path","_callee6$","_context6","FileHandle","open","stat","from","_x7","exports"],"sources":["../../../../src/slpk-extractor/helpers/file-handle-file.ts"],"sourcesContent":["import {FileProvider} from '@loaders.gl/zip';\nimport {FileHandle} from './fs-promises';\n\n/**\n * Provides file data using node fs library\n */\nexport class FileHandleFile implements FileProvider {\n /**\n * Returns a new copy of FileHandleFile\n * @param path The path to the file in file system\n */\n static async from(path: string): Promise<FileHandleFile> {\n const fileDescriptor = await FileHandle.open(path);\n return new FileHandleFile(fileDescriptor, fileDescriptor.stat.size);\n }\n\n /**\n * The FileHandle from which data is provided\n */\n private fileDescriptor: FileHandle;\n\n /**\n * The file length in bytes\n */\n private size: bigint;\n\n private constructor(fileDescriptor: FileHandle, size: bigint) {\n this.fileDescriptor = fileDescriptor;\n this.size = size;\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 async getUint8(offset: bigint): Promise<number> {\n const val = new Uint8Array(\n (await this.fileDescriptor.read(Buffer.alloc(1), 0, 1, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\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 async getUint16(offset: bigint): Promise<number> {\n const val = new Uint16Array(\n (await this.fileDescriptor.read(Buffer.alloc(2), 0, 2, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\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 async getUint32(offset: bigint): Promise<number> {\n const val = new Uint32Array(\n (await this.fileDescriptor.read(Buffer.alloc(4), 0, 4, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\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 async getBigUint64(offset: bigint): Promise<bigint> {\n const val = new BigInt64Array(\n (await this.fileDescriptor.read(Buffer.alloc(8), 0, 8, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\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 startOffsset The offset, in byte, 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 async slice(startOffsset: bigint, endOffset: bigint): Promise<ArrayBuffer> {\n const bigLength = endOffset - startOffsset;\n if (bigLength > Number.MAX_SAFE_INTEGER) {\n throw new Error('too big slice');\n }\n const length = Number(bigLength);\n return (await this.fileDescriptor.read(Buffer.alloc(length), 0, length, startOffsset)).buffer\n .buffer;\n }\n\n /**\n * the length (in bytes) of the data.\n */\n get length(): bigint {\n return this.size;\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAAyC,IAK5BC,cAAc;EAoBzB,SAAAA,eAAoBC,cAA0B,EAAEC,IAAY,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAJ,cAAA;IAAA,IAAAK,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAC5D,IAAI,CAACH,cAAc,GAAGA,cAAc;IACpC,IAAI,CAACC,IAAI,GAAGA,IAAI;EAClB;EAAC,IAAAI,aAAA,CAAAF,OAAA,EAAAJ,cAAA;IAAAO,GAAA;IAAAC,KAAA;MAAA,IAAAC,QAAA,OAAAC,kBAAA,CAAAN,OAAA,EAAAO,YAAA,CAAAP,OAAA,CAAAQ,IAAA,CAMD,SAAAC,Q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A;QAAA,GAAA2B,QAAA;MAAA,CACV;MAAA,SAAAS,MAAAC,GAAA,EAAAC,GAAA;QAAA,OAAAZ,MAAA,CAAAvB,KAAA,OAAAC,SAAA;MAAA;MAAA,OAAAgC,KAAA;IAAA;EAAA;IAAA9D,GAAA;IAAAiE,GAAA,EAKD,SAAAA,IAAA,EAAqB;MACnB,OAAO,IAAI,CAACtE,IAAI;IAClB;EAAC;IAAAK,GAAA;IAAAC,KAAA;MAAA,IAAAiE,KAAA,OAAA/D,kBAAA,CAAAN,OAAA,EAAAO,YAAA,CAAAP,OAAA,CAAAQ,IAAA,CAhGD,SAAA8D,SAAkBC,IAAY;QAAA,IAAA1E,cAAA;QAAA,OAAAU,YAAA,CAAAP,OAAA,CAAAY,IAAA,UAAA4D,UAAAC,SAAA;UAAA,kBAAAA,SAAA,CAAA1D,IAAA,GAAA0D,SAAA,CAAAzD,IAAA;YAAA;cAAAyD,SAAA,CAAAzD,IAAA;cAAA,OACC0D,sBAAU,CAACC,IAAI,CAACJ,IAAI,CAAC;YAAA;cAA5C1E,cAAc,GAAA4E,SAAA,CAAAlD,IAAA;cAAA,OAAAkD,SAAA,CAAA7C,MAAA,WACb,IAAIhC,cAAc,CAACC,cAAc,EAAEA,cAAc,CAAC+E,IAAI,CAAC9E,IAAI,CAAC;YAAA;YAAA;cAAA,OAAA2E,SAAA,CAAA5C,IAAA;UAAA;QAAA,GAAAyC,QAAA;MAAA,CACpE;MAAA,SAAAO,KAAAC,GAAA;QAAA,OAAAT,KAAA,CAAArC,KAAA,OAAAC,SAAA;MAAA;MAAA,OAAA4C,IAAA;IAAA;EAAA;EAAA,OAAAjF,cAAA;AAAA;AAAAmF,OAAA,CAAAnF,cAAA,GAAAA,cAAA"}
@@ -1,77 +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.FileHandle = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- var _fs = require("fs");
15
- var FileHandle = function () {
16
- function FileHandle(fileDescriptor, stats) {
17
- var _this = this;
18
- (0, _classCallCheck2.default)(this, FileHandle);
19
- (0, _defineProperty2.default)(this, "fileDescriptor", void 0);
20
- (0, _defineProperty2.default)(this, "stats", void 0);
21
- (0, _defineProperty2.default)(this, "read", function (buffer, offset, length, position) {
22
- return new Promise(function (s) {
23
- (0, _fs.read)(_this.fileDescriptor, buffer, offset, length, position, function (_err, bytesRead, buffer) {
24
- return s({
25
- bytesRead: bytesRead,
26
- buffer: buffer
27
- });
28
- });
29
- });
30
- });
31
- this.fileDescriptor = fileDescriptor;
32
- this.stats = stats;
33
- }
34
- (0, _createClass2.default)(FileHandle, [{
35
- key: "stat",
36
- get: function get() {
37
- return this.stats;
38
- }
39
- }]);
40
- return FileHandle;
41
- }();
42
- exports.FileHandle = FileHandle;
43
- (0, _defineProperty2.default)(FileHandle, "open", function () {
44
- var _ref = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(path) {
45
- var _yield$Promise$all, _yield$Promise$all2, fd, stats;
46
- return _regenerator.default.wrap(function _callee$(_context) {
47
- while (1) switch (_context.prev = _context.next) {
48
- case 0:
49
- _context.next = 2;
50
- return Promise.all([new Promise(function (s) {
51
- (0, _fs.open)(path, undefined, undefined, function (_err, fd) {
52
- return s(fd);
53
- });
54
- }), new Promise(function (s) {
55
- (0, _fs.stat)(path, {
56
- bigint: true
57
- }, function (_err, stats) {
58
- return s(stats);
59
- });
60
- })]);
61
- case 2:
62
- _yield$Promise$all = _context.sent;
63
- _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 2);
64
- fd = _yield$Promise$all2[0];
65
- stats = _yield$Promise$all2[1];
66
- return _context.abrupt("return", new FileHandle(fd, stats));
67
- case 7:
68
- case "end":
69
- return _context.stop();
70
- }
71
- }, _callee);
72
- }));
73
- return function (_x) {
74
- return _ref.apply(this, arguments);
75
- };
76
- }());
77
- //# sourceMappingURL=fs-promises.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fs-promises.js","names":["_fs","require","FileHandle","fileDescriptor","stats","_this","_classCallCheck2","default","_defineProperty2","buffer","offset","length","position","Promise","s","read","_err","bytesRead","_createClass2","key","get","exports","_ref","_asyncToGenerator2","_regenerator","mark","_callee","path","_yield$Promise$all","_yield$Promise$all2","fd","wrap","_callee$","_context","prev","next","all","open","undefined","stat","bigint","sent","_slicedToArray2","abrupt","stop","_x","apply","arguments"],"sources":["../../../../src/slpk-extractor/helpers/fs-promises.ts"],"sourcesContent":["import {read, open, stat, BigIntStats} from 'fs';\n\n/** file reading result */\nexport type FileReadResult = {\n /** amount of the bytes read */\n bytesRead: number;\n /** the buffer filled with data from file*/\n buffer: Buffer;\n};\n\n/** Object handling file info */\nexport class FileHandle {\n private fileDescriptor: number;\n private stats: BigIntStats;\n private constructor(fileDescriptor: number, stats: BigIntStats) {\n this.fileDescriptor = fileDescriptor;\n this.stats = stats;\n }\n /**\n * Opens a `FileHandle`.\n *\n * @param path path to the file\n * @return Fulfills with a {FileHandle} object.\n */\n\n static open = async (path: string): Promise<FileHandle> => {\n const [fd, stats] = await Promise.all([\n new Promise<number>((s) => {\n open(path, undefined, undefined, (_err, fd) => s(fd));\n }),\n new Promise<BigIntStats>((s) => {\n stat(path, {bigint: true}, (_err, stats) => s(stats));\n })\n ]);\n return new FileHandle(fd, stats);\n };\n\n /**\n * Reads data from the file and stores that in the given buffer.\n *\n * If the file is not modified concurrently, the end-of-file is reached when the\n * number of bytes read is zero.\n * @param buffer A buffer that will be filled with the file data read.\n * @param offset The location in the buffer at which to start filling.\n * @param length The number of bytes to read.\n * @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\n * integer, the current file position will remain unchanged.\n * @return Fulfills upon success with a FileReadResult object\n */\n read = (\n buffer: Buffer,\n offset: number,\n length: number,\n position: number | bigint\n ): Promise<FileReadResult> => {\n return new Promise((s) => {\n read(this.fileDescriptor, buffer, offset, length, position, (_err, bytesRead, buffer) =>\n s({bytesRead, buffer})\n );\n });\n };\n\n get stat(): BigIntStats {\n return this.stats;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AAAiD,IAWpCC,UAAU;EAGrB,SAAAA,WAAoBC,cAAsB,EAAEC,KAAkB,EAAE;IAAA,IAAAC,KAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAL,UAAA;IAAA,IAAAM,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA,gBAmCzD,UACLE,MAAc,EACdC,MAAc,EACdC,MAAc,EACdC,QAAyB,EACG;MAC5B,OAAO,IAAIC,OAAO,CAAC,UAACC,CAAC,EAAK;QACxB,IAAAC,QAAI,EAACV,KAAI,CAACF,cAAc,EAAEM,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,QAAQ,EAAE,UAACI,IAAI,EAAEC,SAAS,EAAER,MAAM;UAAA,OAClFK,CAAC,CAAC;YAACG,SAAS,EAATA,SAAS;YAAER,MAAM,EAANA;UAAM,CAAC,CAAC;QAAA,CACxB,CAAC;MACH,CAAC,CAAC;IACJ,CAAC;IA7CC,IAAI,CAACN,cAAc,GAAGA,cAAc;IACpC,IAAI,CAACC,KAAK,GAAGA,KAAK;EACpB;EAAC,IAAAc,aAAA,CAAAX,OAAA,EAAAL,UAAA;IAAAiB,GAAA;IAAAC,GAAA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E,EAAE1B,KAAK,CAAC;QAAA;QAAA;UAAA,OAAA6B,QAAA,CAAAW,IAAA;MAAA;IAAA,GAAAlB,OAAA;EAAA,CACjC;EAAA,iBAAAmB,EAAA;IAAA,OAAAvB,IAAA,CAAAwB,KAAA,OAAAC,SAAA;EAAA;AAAA"}
@@ -1,54 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { FileHandle } from './fs-promises';
3
- export class FileHandleFile {
4
- static async from(path) {
5
- const fileDescriptor = await FileHandle.open(path);
6
- return new FileHandleFile(fileDescriptor, fileDescriptor.stat.size);
7
- }
8
- constructor(fileDescriptor, size) {
9
- _defineProperty(this, "fileDescriptor", void 0);
10
- _defineProperty(this, "size", void 0);
11
- this.fileDescriptor = fileDescriptor;
12
- this.size = size;
13
- }
14
- async getUint8(offset) {
15
- const val = new Uint8Array((await this.fileDescriptor.read(Buffer.alloc(1), 0, 1, offset)).buffer.buffer).at(0);
16
- if (val === undefined) {
17
- throw new Error('something went wrong');
18
- }
19
- return val;
20
- }
21
- async getUint16(offset) {
22
- const val = new Uint16Array((await this.fileDescriptor.read(Buffer.alloc(2), 0, 2, offset)).buffer.buffer).at(0);
23
- if (val === undefined) {
24
- throw new Error('something went wrong');
25
- }
26
- return val;
27
- }
28
- async getUint32(offset) {
29
- const val = new Uint32Array((await this.fileDescriptor.read(Buffer.alloc(4), 0, 4, offset)).buffer.buffer).at(0);
30
- if (val === undefined) {
31
- throw new Error('something went wrong');
32
- }
33
- return val;
34
- }
35
- async getBigUint64(offset) {
36
- const val = new BigInt64Array((await this.fileDescriptor.read(Buffer.alloc(8), 0, 8, offset)).buffer.buffer).at(0);
37
- if (val === undefined) {
38
- throw new Error('something went wrong');
39
- }
40
- return val;
41
- }
42
- async slice(startOffsset, endOffset) {
43
- const bigLength = endOffset - startOffsset;
44
- if (bigLength > Number.MAX_SAFE_INTEGER) {
45
- throw new Error('too big slice');
46
- }
47
- const length = Number(bigLength);
48
- return (await this.fileDescriptor.read(Buffer.alloc(length), 0, length, startOffsset)).buffer.buffer;
49
- }
50
- get length() {
51
- return this.size;
52
- }
53
- }
54
- //# sourceMappingURL=file-handle-file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-handle-file.js","names":["FileHandle","FileHandleFile","from","path","fileDescriptor","open","stat","size","constructor","_defineProperty","getUint8","offset","val","Uint8Array","read","Buffer","alloc","buffer","at","undefined","Error","getUint16","Uint16Array","getUint32","Uint32Array","getBigUint64","BigInt64Array","slice","startOffsset","endOffset","bigLength","Number","MAX_SAFE_INTEGER","length"],"sources":["../../../../src/slpk-extractor/helpers/file-handle-file.ts"],"sourcesContent":["import {FileProvider} from '@loaders.gl/zip';\nimport {FileHandle} from './fs-promises';\n\n/**\n * Provides file data using node fs library\n */\nexport class FileHandleFile implements FileProvider {\n /**\n * Returns a new copy of FileHandleFile\n * @param path The path to the file in file system\n */\n static async from(path: string): Promise<FileHandleFile> {\n const fileDescriptor = await FileHandle.open(path);\n return new FileHandleFile(fileDescriptor, fileDescriptor.stat.size);\n }\n\n /**\n * The FileHandle from which data is provided\n */\n private fileDescriptor: FileHandle;\n\n /**\n * The file length in bytes\n */\n private size: bigint;\n\n private constructor(fileDescriptor: FileHandle, size: bigint) {\n this.fileDescriptor = fileDescriptor;\n this.size = size;\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 async getUint8(offset: bigint): Promise<number> {\n const val = new Uint8Array(\n (await this.fileDescriptor.read(Buffer.alloc(1), 0, 1, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\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 async getUint16(offset: bigint): Promise<number> {\n const val = new Uint16Array(\n (await this.fileDescriptor.read(Buffer.alloc(2), 0, 2, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\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 async getUint32(offset: bigint): Promise<number> {\n const val = new Uint32Array(\n (await this.fileDescriptor.read(Buffer.alloc(4), 0, 4, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\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 async getBigUint64(offset: bigint): Promise<bigint> {\n const val = new BigInt64Array(\n (await this.fileDescriptor.read(Buffer.alloc(8), 0, 8, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\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 startOffsset The offset, in byte, 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 async slice(startOffsset: bigint, endOffset: bigint): Promise<ArrayBuffer> {\n const bigLength = endOffset - startOffsset;\n if (bigLength > Number.MAX_SAFE_INTEGER) {\n throw new Error('too big slice');\n }\n const length = Number(bigLength);\n return (await this.fileDescriptor.read(Buffer.alloc(length), 0, length, startOffsset)).buffer\n .buffer;\n }\n\n /**\n * the length (in bytes) of the data.\n */\n get length(): bigint {\n return this.size;\n }\n}\n"],"mappings":";AACA,SAAQA,UAAU,QAAO,eAAe;AAKxC,OAAO,MAAMC,cAAc,CAAyB;EAKlD,aAAaC,IAAIA,CAACC,IAAY,EAA2B;IACvD,MAAMC,cAAc,GAAG,MAAMJ,UAAU,CAACK,IAAI,CAACF,IAAI,CAAC;IAClD,OAAO,IAAIF,cAAc,CAACG,cAAc,EAAEA,cAAc,CAACE,IAAI,CAACC,IAAI,CAAC;EACrE;EAYQC,WAAWA,CAACJ,cAA0B,EAAEG,I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CAAC,sBAAsB,CAAC;IACzC;IACA,OAAOR,GAAG;EACZ;EAMA,MAAMa,YAAYA,CAACd,MAAc,EAAmB;IAClD,MAAMC,GAAG,GAAG,IAAIc,aAAa,CAC3B,CAAC,MAAM,IAAI,CAACtB,cAAc,CAACU,IAAI,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAEL,MAAM,CAAC,EAAEM,MAAM,CAACA,MACzE,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC;IACP,IAAIN,GAAG,KAAKO,SAAS,EAAE;MACrB,MAAM,IAAIC,KAAK,CAAC,sBAAsB,CAAC;IACzC;IACA,OAAOR,GAAG;EACZ;EAOA,MAAMe,KAAKA,CAACC,YAAoB,EAAEC,SAAiB,EAAwB;IACzE,MAAMC,SAAS,GAAGD,SAAS,GAAGD,YAAY;IAC1C,IAAIE,SAAS,GAAGC,MAAM,CAACC,gBAAgB,EAAE;MACvC,MAAM,IAAIZ,KAAK,CAAC,eAAe,CAAC;IAClC;IACA,MAAMa,MAAM,GAAGF,MAAM,CAACD,SAAS,CAAC;IAChC,OAAO,CAAC,MAAM,IAAI,CAAC1B,cAAc,CAACU,IAAI,CAACC,MAAM,CAACC,KAAK,CAACiB,MAAM,CAAC,EAAE,CAAC,EAAEA,MAAM,EAAEL,YAAY,CAAC,EAAEX,MAAM,CAC1FA,MAAM;EACX;EAKA,IAAIgB,MAAMA,CAAA,EAAW;IACnB,OAAO,IAAI,CAAC1B,IAAI;EAClB;AACF"}
@@ -1,32 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { read, open, stat } from 'fs';
3
- export class FileHandle {
4
- constructor(fileDescriptor, stats) {
5
- _defineProperty(this, "fileDescriptor", void 0);
6
- _defineProperty(this, "stats", void 0);
7
- _defineProperty(this, "read", (buffer, offset, length, position) => {
8
- return new Promise(s => {
9
- read(this.fileDescriptor, buffer, offset, length, position, (_err, bytesRead, buffer) => s({
10
- bytesRead,
11
- buffer
12
- }));
13
- });
14
- });
15
- this.fileDescriptor = fileDescriptor;
16
- this.stats = stats;
17
- }
18
- get stat() {
19
- return this.stats;
20
- }
21
- }
22
- _defineProperty(FileHandle, "open", async path => {
23
- const [fd, stats] = await Promise.all([new Promise(s => {
24
- open(path, undefined, undefined, (_err, fd) => s(fd));
25
- }), new Promise(s => {
26
- stat(path, {
27
- bigint: true
28
- }, (_err, stats) => s(stats));
29
- })]);
30
- return new FileHandle(fd, stats);
31
- });
32
- //# sourceMappingURL=fs-promises.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fs-promises.js","names":["read","open","stat","FileHandle","constructor","fileDescriptor","stats","_defineProperty","buffer","offset","length","position","Promise","s","_err","bytesRead","path","fd","all","undefined","bigint"],"sources":["../../../../src/slpk-extractor/helpers/fs-promises.ts"],"sourcesContent":["import {read, open, stat, BigIntStats} from 'fs';\n\n/** file reading result */\nexport type FileReadResult = {\n /** amount of the bytes read */\n bytesRead: number;\n /** the buffer filled with data from file*/\n buffer: Buffer;\n};\n\n/** Object handling file info */\nexport class FileHandle {\n private fileDescriptor: number;\n private stats: BigIntStats;\n private constructor(fileDescriptor: number, stats: BigIntStats) {\n this.fileDescriptor = fileDescriptor;\n this.stats = stats;\n }\n /**\n * Opens a `FileHandle`.\n *\n * @param path path to the file\n * @return Fulfills with a {FileHandle} object.\n */\n\n static open = async (path: string): Promise<FileHandle> => {\n const [fd, stats] = await Promise.all([\n new Promise<number>((s) => {\n open(path, undefined, undefined, (_err, fd) => s(fd));\n }),\n new Promise<BigIntStats>((s) => {\n stat(path, {bigint: true}, (_err, stats) => s(stats));\n })\n ]);\n return new FileHandle(fd, stats);\n };\n\n /**\n * Reads data from the file and stores that in the given buffer.\n *\n * If the file is not modified concurrently, the end-of-file is reached when the\n * number of bytes read is zero.\n * @param buffer A buffer that will be filled with the file data read.\n * @param offset The location in the buffer at which to start filling.\n * @param length The number of bytes to read.\n * @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\n * integer, the current file position will remain unchanged.\n * @return Fulfills upon success with a FileReadResult object\n */\n read = (\n buffer: Buffer,\n offset: number,\n length: number,\n position: number | bigint\n ): Promise<FileReadResult> => {\n return new Promise((s) => {\n read(this.fileDescriptor, buffer, offset, length, position, (_err, bytesRead, buffer) =>\n s({bytesRead, buffer})\n );\n });\n };\n\n get stat(): BigIntStats {\n return this.stats;\n }\n}\n"],"mappings":";AAAA,SAAQA,IAAI,EAAEC,IAAI,EAAEC,IAAI,QAAoB,IAAI;AAWhD,OAAO,MAAMC,UAAU,CAAC;EAGdC,WAAWA,CAACC,cAAsB,EAAEC,KAAkB,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA,eAmCzD,CACLC,MAAc,EACdC,MAAc,EACdC,MAAc,EACdC,QAAyB,KACG;MAC5B,OAAO,IAAIC,OAAO,CAAEC,CAAC,IAAK;QACxBb,IAAI,CAAC,IAAI,CAACK,cAAc,EAAEG,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,QAAQ,EAAE,CAACG,IAAI,EAAEC,SAAS,EAAEP,MAAM,KAClFK,CAAC,CAAC;UAACE,SAAS;UAAEP;QAAM,CAAC,CACvB,CAAC;MACH,CAAC,CAAC;IACJ,CAAC;IA7CC,IAAI,CAACH,cAAc,GAAGA,cAAc;IACpC,IAAI,CAACC,KAAK,GAAGA,KAAK;EACpB;EA6CA,IAAIJ,IAAIA,CAAA,EAAgB;IACtB,OAAO,IAAI,CAACI,KAAK;EACnB;AACF;AAACC,eAAA,CAtDYJ,UAAU,UAcP,MAAOa,IAAY,IAA0B;EACzD,MAAM,CAACC,EAAE,EAAEX,KAAK,CAAC,GAAG,MAAMM,OAAO,CAACM,GAAG,CAAC,CACpC,IAAIN,OAAO,CAAUC,CAAC,IAAK;IACzBZ,IAAI,CAACe,IAAI,EAAEG,SAAS,EAAEA,SAAS,EAAE,CAACL,IAAI,EAAEG,EAAE,KAAKJ,CAAC,CAACI,EAAE,CAAC,CAAC;EACvD,CAAC,CAAC,EACF,IAAIL,OAAO,CAAeC,CAAC,IAAK;IAC9BX,IAAI,CAACc,IAAI,EAAE;MAACI,MAAM,EAAE;IAAI,CAAC,EAAE,CAACN,IAAI,EAAER,KAAK,KAAKO,CAAC,CAACP,KAAK,CAAC,CAAC;EACvD,CAAC,CAAC,CACH,CAAC;EACF,OAAO,IAAIH,UAAU,CAACc,EAAE,EAAEX,KAAK,CAAC;AAClC,CAAC"}
@@ -1,51 +0,0 @@
1
- import { FileProvider } from '@loaders.gl/zip';
2
- /**
3
- * Provides file data using node fs library
4
- */
5
- export declare class FileHandleFile implements FileProvider {
6
- /**
7
- * Returns a new copy of FileHandleFile
8
- * @param path The path to the file in file system
9
- */
10
- static from(path: string): Promise<FileHandleFile>;
11
- /**
12
- * The FileHandle from which data is provided
13
- */
14
- private fileDescriptor;
15
- /**
16
- * The file length in bytes
17
- */
18
- private size;
19
- private constructor();
20
- /**
21
- * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
22
- * @param offset The offset, in bytes, from the start of the file where to read the data.
23
- */
24
- getUint8(offset: bigint): Promise<number>;
25
- /**
26
- * Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.
27
- * @param offset The offset, in bytes, from the start of the file where to read the data.
28
- */
29
- getUint16(offset: bigint): Promise<number>;
30
- /**
31
- * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
32
- * @param offset The offset, in bytes, from the start of the file where to read the data.
33
- */
34
- getUint32(offset: bigint): Promise<number>;
35
- /**
36
- * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
37
- * @param offset The offset, in bytes, from the start of the file where to read the data.
38
- */
39
- getBigUint64(offset: bigint): Promise<bigint>;
40
- /**
41
- * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
42
- * @param startOffsset The offset, in byte, from the start of the file where to start reading the data.
43
- * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
44
- */
45
- slice(startOffsset: bigint, endOffset: bigint): Promise<ArrayBuffer>;
46
- /**
47
- * the length (in bytes) of the data.
48
- */
49
- get length(): bigint;
50
- }
51
- //# sourceMappingURL=file-handle-file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-handle-file.d.ts","sourceRoot":"","sources":["../../../src/slpk-extractor/helpers/file-handle-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAG7C;;GAEG;AACH,qBAAa,cAAe,YAAW,YAAY;IACjD;;;OAGG;WACU,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAKxD;;OAEG;IACH,OAAO,CAAC,cAAc,CAAa;IAEnC;;OAEG;IACH,OAAO,CAAC,IAAI,CAAS;IAErB,OAAO;IAKP;;;OAGG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAU/C;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUhD;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUhD;;;OAGG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUnD;;;;OAIG;IACG,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAU1E;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;CACF"}