@loaders.gl/zip 4.2.0-alpha.5 → 4.2.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +41 -23
- package/dist/dist.min.js +1 -1
- package/dist/filesystems/IndexedArchive.js +2 -0
- package/dist/filesystems/zip-filesystem.d.ts.map +1 -1
- package/dist/filesystems/zip-filesystem.js +7 -3
- package/dist/index.cjs +18 -6
- package/dist/index.cjs.map +2 -2
- package/dist/lib/tar/tar.js +4 -1
- package/dist/tar-builder.js +3 -1
- package/dist/zip-loader.js +1 -1
- package/dist/zip-writer.js +1 -1
- package/package.json +5 -5
- package/src/filesystems/zip-filesystem.ts +4 -0
package/dist/dist.dev.js
CHANGED
|
@@ -7136,11 +7136,14 @@ var __exports__ = (() => {
|
|
|
7136
7136
|
var inputLength;
|
|
7137
7137
|
var recordSize = 512;
|
|
7138
7138
|
var Tar = class {
|
|
7139
|
+
written;
|
|
7140
|
+
out;
|
|
7141
|
+
blocks = [];
|
|
7142
|
+
length;
|
|
7139
7143
|
/**
|
|
7140
7144
|
* @param [recordsPerBlock]
|
|
7141
7145
|
*/
|
|
7142
7146
|
constructor(recordsPerBlock) {
|
|
7143
|
-
this.blocks = [];
|
|
7144
7147
|
this.written = 0;
|
|
7145
7148
|
blockSize = (recordsPerBlock || 20) * recordSize;
|
|
7146
7149
|
this.out = clean(blockSize);
|
|
@@ -7257,11 +7260,6 @@ var __exports__ = (() => {
|
|
|
7257
7260
|
recordsPerBlock: 20
|
|
7258
7261
|
};
|
|
7259
7262
|
var TarBuilder = class {
|
|
7260
|
-
constructor(options) {
|
|
7261
|
-
this.count = 0;
|
|
7262
|
-
this.options = { ...TAR_BUILDER_OPTIONS, ...options };
|
|
7263
|
-
this.tape = new tar_default(this.options.recordsPerBlock);
|
|
7264
|
-
}
|
|
7265
7263
|
static get properties() {
|
|
7266
7264
|
return {
|
|
7267
7265
|
id: "tar",
|
|
@@ -7272,6 +7270,13 @@ var __exports__ = (() => {
|
|
|
7272
7270
|
options: TAR_BUILDER_OPTIONS
|
|
7273
7271
|
};
|
|
7274
7272
|
}
|
|
7273
|
+
options;
|
|
7274
|
+
tape;
|
|
7275
|
+
count = 0;
|
|
7276
|
+
constructor(options) {
|
|
7277
|
+
this.options = { ...TAR_BUILDER_OPTIONS, ...options };
|
|
7278
|
+
this.tape = new tar_default(this.options.recordsPerBlock);
|
|
7279
|
+
}
|
|
7275
7280
|
/** Adds a file to the archive. */
|
|
7276
7281
|
addFile(filename2, buffer) {
|
|
7277
7282
|
this.tape.append(filename2, new Uint8Array(buffer));
|
|
@@ -7527,10 +7532,11 @@ var __exports__ = (() => {
|
|
|
7527
7532
|
// ../loader-utils/src/lib/files/node-file-facade.ts
|
|
7528
7533
|
var NOT_IMPLEMENTED = new Error("Not implemented");
|
|
7529
7534
|
var NodeFileFacade = class {
|
|
7535
|
+
handle;
|
|
7536
|
+
size = 0;
|
|
7537
|
+
bigsize = 0n;
|
|
7538
|
+
url = "";
|
|
7530
7539
|
constructor(url, flags, mode) {
|
|
7531
|
-
this.size = 0;
|
|
7532
|
-
this.bigsize = 0n;
|
|
7533
|
-
this.url = "";
|
|
7534
7540
|
if (globalThis.loaders?.NodeFile) {
|
|
7535
7541
|
return new globalThis.loaders.NodeFile(url, flags, mode);
|
|
7536
7542
|
}
|
|
@@ -7569,10 +7575,6 @@ var __exports__ = (() => {
|
|
|
7569
7575
|
var NodeFileSystemFacade = class {
|
|
7570
7576
|
// implements FileSystem
|
|
7571
7577
|
constructor(options) {
|
|
7572
|
-
// DUMMY IMPLEMENTATION, not used (constructor returns a real NodeFileSystem instance)
|
|
7573
|
-
// implements RandomAccessReadFileSystem
|
|
7574
|
-
this.readable = true;
|
|
7575
|
-
this.writable = true;
|
|
7576
7578
|
if (globalThis.loaders?.NodeFileSystem) {
|
|
7577
7579
|
return new globalThis.loaders.NodeFileSystem(options);
|
|
7578
7580
|
}
|
|
@@ -7583,6 +7585,10 @@ var __exports__ = (() => {
|
|
|
7583
7585
|
"Can't instantiate NodeFileSystem. Make sure to import @loaders.gl/polyfills first."
|
|
7584
7586
|
);
|
|
7585
7587
|
}
|
|
7588
|
+
// DUMMY IMPLEMENTATION, not used (constructor returns a real NodeFileSystem instance)
|
|
7589
|
+
// implements RandomAccessReadFileSystem
|
|
7590
|
+
readable = true;
|
|
7591
|
+
writable = true;
|
|
7586
7592
|
async openReadableFile(path, flags) {
|
|
7587
7593
|
throw NOT_IMPLEMENTED2;
|
|
7588
7594
|
}
|
|
@@ -7612,6 +7618,8 @@ var __exports__ = (() => {
|
|
|
7612
7618
|
|
|
7613
7619
|
// ../loader-utils/src/lib/file-provider/file-handle-file.ts
|
|
7614
7620
|
var FileHandleFile = class {
|
|
7621
|
+
/** The FileHandle from which data is provided */
|
|
7622
|
+
file;
|
|
7615
7623
|
/** Create a new FileHandleFile */
|
|
7616
7624
|
constructor(path, append = false) {
|
|
7617
7625
|
this.file = new NodeFileFacade(path, append ? "a+" : "r");
|
|
@@ -8444,6 +8452,7 @@ var __exports__ = (() => {
|
|
|
8444
8452
|
|
|
8445
8453
|
// ../crypto/src/lib/algorithms/crc32.ts
|
|
8446
8454
|
var CRC32 = class {
|
|
8455
|
+
crc;
|
|
8447
8456
|
constructor() {
|
|
8448
8457
|
this.crc = ~0;
|
|
8449
8458
|
}
|
|
@@ -8808,9 +8817,10 @@ var __exports__ = (() => {
|
|
|
8808
8817
|
|
|
8809
8818
|
// ../crypto/src/lib/crc32-hash.ts
|
|
8810
8819
|
var CRC32Hash = class extends Hash {
|
|
8820
|
+
name = "crc32";
|
|
8821
|
+
options;
|
|
8811
8822
|
constructor(options = {}) {
|
|
8812
8823
|
super();
|
|
8813
|
-
this.name = "crc32";
|
|
8814
8824
|
this.options = { crypto: {}, ...options };
|
|
8815
8825
|
this.hashBatches = this.hashBatches.bind(this);
|
|
8816
8826
|
}
|
|
@@ -9248,9 +9258,10 @@ var __exports__ = (() => {
|
|
|
9248
9258
|
|
|
9249
9259
|
// ../crypto/src/lib/md5-hash.ts
|
|
9250
9260
|
var MD5Hash = class extends Hash {
|
|
9261
|
+
name = "md5";
|
|
9262
|
+
options;
|
|
9251
9263
|
constructor(options = {}) {
|
|
9252
9264
|
super();
|
|
9253
|
-
this.name = "md5";
|
|
9254
9265
|
this.options = options;
|
|
9255
9266
|
}
|
|
9256
9267
|
/**
|
|
@@ -9434,13 +9445,14 @@ var __exports__ = (() => {
|
|
|
9434
9445
|
var import_pako = __toESM(require_pako(), 1);
|
|
9435
9446
|
var import_zlib = __toESM(require_zlib(), 1);
|
|
9436
9447
|
var DeflateCompression = class extends Compression {
|
|
9448
|
+
name = "deflate";
|
|
9449
|
+
extensions = [];
|
|
9450
|
+
contentEncodings = ["deflate"];
|
|
9451
|
+
isSupported = true;
|
|
9452
|
+
options;
|
|
9453
|
+
_chunks = [];
|
|
9437
9454
|
constructor(options = {}) {
|
|
9438
9455
|
super(options);
|
|
9439
|
-
this.name = "deflate";
|
|
9440
|
-
this.extensions = [];
|
|
9441
|
-
this.contentEncodings = ["deflate"];
|
|
9442
|
-
this.isSupported = true;
|
|
9443
|
-
this._chunks = [];
|
|
9444
9456
|
this.options = options;
|
|
9445
9457
|
}
|
|
9446
9458
|
async compress(input) {
|
|
@@ -9557,14 +9569,15 @@ var __exports__ = (() => {
|
|
|
9557
9569
|
}
|
|
9558
9570
|
};
|
|
9559
9571
|
var ZipFileSystem = class {
|
|
9572
|
+
/** FileProvider instance promise */
|
|
9573
|
+
fileProvider = null;
|
|
9574
|
+
fileName;
|
|
9575
|
+
archive = null;
|
|
9560
9576
|
/**
|
|
9561
9577
|
* Constructor
|
|
9562
9578
|
* @param file - instance of FileProvider or file path string
|
|
9563
9579
|
*/
|
|
9564
9580
|
constructor(file) {
|
|
9565
|
-
/** FileProvider instance promise */
|
|
9566
|
-
this.fileProvider = null;
|
|
9567
|
-
this.archive = null;
|
|
9568
9581
|
if (typeof file === "string") {
|
|
9569
9582
|
this.fileName = file;
|
|
9570
9583
|
if (!isBrowser) {
|
|
@@ -9616,6 +9629,9 @@ var __exports__ = (() => {
|
|
|
9616
9629
|
* @returns - Response with file data
|
|
9617
9630
|
*/
|
|
9618
9631
|
async fetch(filename2) {
|
|
9632
|
+
if (this.fileName && filename2.indexOf(this.fileName) === 0) {
|
|
9633
|
+
filename2 = filename2.substring(this.fileName.length + 1);
|
|
9634
|
+
}
|
|
9619
9635
|
let uncompressedFile;
|
|
9620
9636
|
if (this.archive) {
|
|
9621
9637
|
uncompressedFile = await this.archive.getFile(filename2, "http");
|
|
@@ -9673,6 +9689,8 @@ var __exports__ = (() => {
|
|
|
9673
9689
|
|
|
9674
9690
|
// src/filesystems/IndexedArchive.ts
|
|
9675
9691
|
var IndexedArchive = class {
|
|
9692
|
+
fileProvider;
|
|
9693
|
+
fileName;
|
|
9676
9694
|
/**
|
|
9677
9695
|
* Constructor
|
|
9678
9696
|
* @param fileProvider - instance of a binary data reader
|