@zip.js/zip.js 2.7.14 → 2.7.15

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.
@@ -10135,7 +10135,7 @@
10135
10135
  id: fs.entries.length,
10136
10136
  parent,
10137
10137
  children: [],
10138
- uncompressedSize: 0
10138
+ uncompressedSize: params.uncompressedSize || 0
10139
10139
  });
10140
10140
  fs.entries.push(zipEntry);
10141
10141
  if (parent) {
@@ -10332,7 +10332,8 @@
10332
10332
  data: text,
10333
10333
  Reader: TextReader,
10334
10334
  Writer: TextWriter,
10335
- options
10335
+ options,
10336
+ uncompressedSize: text.length
10336
10337
  });
10337
10338
  }
10338
10339
 
@@ -10341,16 +10342,23 @@
10341
10342
  data: blob,
10342
10343
  Reader: BlobReader,
10343
10344
  Writer: BlobWriter,
10344
- options
10345
+ options,
10346
+ uncompressedSize: blob.size
10345
10347
  });
10346
10348
  }
10347
10349
 
10348
10350
  addData64URI(name, dataURI, options = {}) {
10351
+ let dataEnd = dataURI.length;
10352
+ while (dataURI.charAt(dataEnd - 1) == "=") {
10353
+ dataEnd--;
10354
+ }
10355
+ const dataStart = dataURI.indexOf(",") + 1;
10349
10356
  return addChild(this, name, {
10350
10357
  data: dataURI,
10351
10358
  Reader: Data64URIReader,
10352
10359
  Writer: Data64URIWriter,
10353
- options
10360
+ options,
10361
+ uncompressedSize: Math.floor((dataEnd - dataStart) * 0.75)
10354
10362
  });
10355
10363
  }
10356
10364
 
@@ -10359,7 +10367,8 @@
10359
10367
  data: array,
10360
10368
  Reader: Uint8ArrayReader,
10361
10369
  Writer: Uint8ArrayWriter,
10362
- options
10370
+ options,
10371
+ uncompressedSize: array.length
10363
10372
  });
10364
10373
  }
10365
10374
 
@@ -10401,7 +10410,8 @@
10401
10410
  const size = file.size;
10402
10411
  return { readable, size };
10403
10412
  },
10404
- options
10413
+ options,
10414
+ uncompressedSize: file.size
10405
10415
  });
10406
10416
  }
10407
10417
 
@@ -10467,7 +10477,8 @@
10467
10477
  if (!entry.directory) {
10468
10478
  importedEntries.push(addChild(parent, name, {
10469
10479
  data: entry,
10470
- Reader: getZipBlobReader(Object.assign({}, options))
10480
+ Reader: getZipBlobReader(Object.assign({}, options)),
10481
+ uncompressedSize: entry.uncompressedSize
10471
10482
  }));
10472
10483
  }
10473
10484
  } catch (error) {
@@ -10820,10 +10831,9 @@
10820
10831
  const size = file.size;
10821
10832
  return { readable, size };
10822
10833
  },
10823
- options: {
10824
- lastModDate: new Date(file.lastModified)
10825
- }
10826
- }, options)
10834
+ options: Object.assign({}, { lastModDate: new Date(file.lastModified) }, options),
10835
+ uncompressedSize: file.size
10836
+ })
10827
10837
  );
10828
10838
  } else if (handle.kind == "directory") {
10829
10839
  const directoryEntry = parentEntry.addDirectory(handle.name);