@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.
package/dist/zip-fs.js CHANGED
@@ -4911,7 +4911,7 @@
4911
4911
  id: fs.entries.length,
4912
4912
  parent,
4913
4913
  children: [],
4914
- uncompressedSize: 0
4914
+ uncompressedSize: params.uncompressedSize || 0
4915
4915
  });
4916
4916
  fs.entries.push(zipEntry);
4917
4917
  if (parent) {
@@ -5108,7 +5108,8 @@
5108
5108
  data: text,
5109
5109
  Reader: TextReader,
5110
5110
  Writer: TextWriter,
5111
- options
5111
+ options,
5112
+ uncompressedSize: text.length
5112
5113
  });
5113
5114
  }
5114
5115
 
@@ -5117,16 +5118,23 @@
5117
5118
  data: blob,
5118
5119
  Reader: BlobReader,
5119
5120
  Writer: BlobWriter,
5120
- options
5121
+ options,
5122
+ uncompressedSize: blob.size
5121
5123
  });
5122
5124
  }
5123
5125
 
5124
5126
  addData64URI(name, dataURI, options = {}) {
5127
+ let dataEnd = dataURI.length;
5128
+ while (dataURI.charAt(dataEnd - 1) == "=") {
5129
+ dataEnd--;
5130
+ }
5131
+ const dataStart = dataURI.indexOf(",") + 1;
5125
5132
  return addChild(this, name, {
5126
5133
  data: dataURI,
5127
5134
  Reader: Data64URIReader,
5128
5135
  Writer: Data64URIWriter,
5129
- options
5136
+ options,
5137
+ uncompressedSize: Math.floor((dataEnd - dataStart) * 0.75)
5130
5138
  });
5131
5139
  }
5132
5140
 
@@ -5135,7 +5143,8 @@
5135
5143
  data: array,
5136
5144
  Reader: Uint8ArrayReader,
5137
5145
  Writer: Uint8ArrayWriter,
5138
- options
5146
+ options,
5147
+ uncompressedSize: array.length
5139
5148
  });
5140
5149
  }
5141
5150
 
@@ -5177,7 +5186,8 @@
5177
5186
  const size = file.size;
5178
5187
  return { readable, size };
5179
5188
  },
5180
- options
5189
+ options,
5190
+ uncompressedSize: file.size
5181
5191
  });
5182
5192
  }
5183
5193
 
@@ -5243,7 +5253,8 @@
5243
5253
  if (!entry.directory) {
5244
5254
  importedEntries.push(addChild(parent, name, {
5245
5255
  data: entry,
5246
- Reader: getZipBlobReader(Object.assign({}, options))
5256
+ Reader: getZipBlobReader(Object.assign({}, options)),
5257
+ uncompressedSize: entry.uncompressedSize
5247
5258
  }));
5248
5259
  }
5249
5260
  } catch (error) {
@@ -5596,10 +5607,9 @@
5596
5607
  const size = file.size;
5597
5608
  return { readable, size };
5598
5609
  },
5599
- options: {
5600
- lastModDate: new Date(file.lastModified)
5601
- }
5602
- }, options)
5610
+ options: Object.assign({}, { lastModDate: new Date(file.lastModified) }, options),
5611
+ uncompressedSize: file.size
5612
+ })
5603
5613
  );
5604
5614
  } else if (handle.kind == "directory") {
5605
5615
  const directoryEntry = parentEntry.addDirectory(handle.name);