Skip to content

Commit 7302740

Browse files
bump version
1 parent e326cfc commit 7302740

File tree

7 files changed

+74
-44
lines changed

7 files changed

+74
-44
lines changed

dist/zip-fs-full.js

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10135,7 +10135,7 @@
1013510135
id: fs.entries.length,
1013610136
parent,
1013710137
children: [],
10138-
uncompressedSize: 0
10138+
uncompressedSize: params.uncompressedSize || 0
1013910139
});
1014010140
fs.entries.push(zipEntry);
1014110141
if (parent) {
@@ -10332,7 +10332,8 @@
1033210332
data: text,
1033310333
Reader: TextReader,
1033410334
Writer: TextWriter,
10335-
options
10335+
options,
10336+
uncompressedSize: text.length
1033610337
});
1033710338
}
1033810339

@@ -10341,16 +10342,23 @@
1034110342
data: blob,
1034210343
Reader: BlobReader,
1034310344
Writer: BlobWriter,
10344-
options
10345+
options,
10346+
uncompressedSize: blob.size
1034510347
});
1034610348
}
1034710349

1034810350
addData64URI(name, dataURI, options = {}) {
10351+
let dataEnd = dataURI.length;
10352+
while (dataURI.charAt(dataEnd - 1) == "=") {
10353+
dataEnd--;
10354+
}
10355+
const dataStart = dataURI.indexOf(",") + 1;
1034910356
return addChild(this, name, {
1035010357
data: dataURI,
1035110358
Reader: Data64URIReader,
1035210359
Writer: Data64URIWriter,
10353-
options
10360+
options,
10361+
uncompressedSize: Math.floor((dataEnd - dataStart) * 0.75)
1035410362
});
1035510363
}
1035610364

@@ -10359,7 +10367,8 @@
1035910367
data: array,
1036010368
Reader: Uint8ArrayReader,
1036110369
Writer: Uint8ArrayWriter,
10362-
options
10370+
options,
10371+
uncompressedSize: array.length
1036310372
});
1036410373
}
1036510374

@@ -10401,7 +10410,8 @@
1040110410
const size = file.size;
1040210411
return { readable, size };
1040310412
},
10404-
options
10413+
options,
10414+
uncompressedSize: file.size
1040510415
});
1040610416
}
1040710417

@@ -10467,7 +10477,8 @@
1046710477
if (!entry.directory) {
1046810478
importedEntries.push(addChild(parent, name, {
1046910479
data: entry,
10470-
Reader: getZipBlobReader(Object.assign({}, options))
10480+
Reader: getZipBlobReader(Object.assign({}, options)),
10481+
uncompressedSize: entry.uncompressedSize
1047110482
}));
1047210483
}
1047310484
} catch (error) {
@@ -10820,10 +10831,9 @@
1082010831
const size = file.size;
1082110832
return { readable, size };
1082210833
},
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+
})
1082710837
);
1082810838
} else if (handle.kind == "directory") {
1082910839
const directoryEntry = parentEntry.addDirectory(handle.name);

dist/zip-fs-full.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/zip-fs.js

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4911,7 +4911,7 @@
49114911
id: fs.entries.length,
49124912
parent,
49134913
children: [],
4914-
uncompressedSize: 0
4914+
uncompressedSize: params.uncompressedSize || 0
49154915
});
49164916
fs.entries.push(zipEntry);
49174917
if (parent) {
@@ -5108,7 +5108,8 @@
51085108
data: text,
51095109
Reader: TextReader,
51105110
Writer: TextWriter,
5111-
options
5111+
options,
5112+
uncompressedSize: text.length
51125113
});
51135114
}
51145115

@@ -5117,16 +5118,23 @@
51175118
data: blob,
51185119
Reader: BlobReader,
51195120
Writer: BlobWriter,
5120-
options
5121+
options,
5122+
uncompressedSize: blob.size
51215123
});
51225124
}
51235125

51245126
addData64URI(name, dataURI, options = {}) {
5127+
let dataEnd = dataURI.length;
5128+
while (dataURI.charAt(dataEnd - 1) == "=") {
5129+
dataEnd--;
5130+
}
5131+
const dataStart = dataURI.indexOf(",") + 1;
51255132
return addChild(this, name, {
51265133
data: dataURI,
51275134
Reader: Data64URIReader,
51285135
Writer: Data64URIWriter,
5129-
options
5136+
options,
5137+
uncompressedSize: Math.floor((dataEnd - dataStart) * 0.75)
51305138
});
51315139
}
51325140

@@ -5135,7 +5143,8 @@
51355143
data: array,
51365144
Reader: Uint8ArrayReader,
51375145
Writer: Uint8ArrayWriter,
5138-
options
5146+
options,
5147+
uncompressedSize: array.length
51395148
});
51405149
}
51415150

@@ -5177,7 +5186,8 @@
51775186
const size = file.size;
51785187
return { readable, size };
51795188
},
5180-
options
5189+
options,
5190+
uncompressedSize: file.size
51815191
});
51825192
}
51835193

@@ -5243,7 +5253,8 @@
52435253
if (!entry.directory) {
52445254
importedEntries.push(addChild(parent, name, {
52455255
data: entry,
5246-
Reader: getZipBlobReader(Object.assign({}, options))
5256+
Reader: getZipBlobReader(Object.assign({}, options)),
5257+
uncompressedSize: entry.uncompressedSize
52475258
}));
52485259
}
52495260
} catch (error) {
@@ -5596,10 +5607,9 @@
55965607
const size = file.size;
55975608
return { readable, size };
55985609
},
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+
})
56035613
);
56045614
} else if (handle.kind == "directory") {
56055615
const directoryEntry = parentEntry.addDirectory(handle.name);

dist/zip-fs.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.cjs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10131,7 +10131,7 @@ class ZipEntry {
1013110131
id: fs.entries.length,
1013210132
parent,
1013310133
children: [],
10134-
uncompressedSize: 0
10134+
uncompressedSize: params.uncompressedSize || 0
1013510135
});
1013610136
fs.entries.push(zipEntry);
1013710137
if (parent) {
@@ -10328,7 +10328,8 @@ class ZipDirectoryEntry extends ZipEntry {
1032810328
data: text,
1032910329
Reader: TextReader,
1033010330
Writer: TextWriter,
10331-
options
10331+
options,
10332+
uncompressedSize: text.length
1033210333
});
1033310334
}
1033410335

@@ -10337,16 +10338,23 @@ class ZipDirectoryEntry extends ZipEntry {
1033710338
data: blob,
1033810339
Reader: BlobReader,
1033910340
Writer: BlobWriter,
10340-
options
10341+
options,
10342+
uncompressedSize: blob.size
1034110343
});
1034210344
}
1034310345

1034410346
addData64URI(name, dataURI, options = {}) {
10347+
let dataEnd = dataURI.length;
10348+
while (dataURI.charAt(dataEnd - 1) == "=") {
10349+
dataEnd--;
10350+
}
10351+
const dataStart = dataURI.indexOf(",") + 1;
1034510352
return addChild(this, name, {
1034610353
data: dataURI,
1034710354
Reader: Data64URIReader,
1034810355
Writer: Data64URIWriter,
10349-
options
10356+
options,
10357+
uncompressedSize: Math.floor((dataEnd - dataStart) * 0.75)
1035010358
});
1035110359
}
1035210360

@@ -10355,7 +10363,8 @@ class ZipDirectoryEntry extends ZipEntry {
1035510363
data: array,
1035610364
Reader: Uint8ArrayReader,
1035710365
Writer: Uint8ArrayWriter,
10358-
options
10366+
options,
10367+
uncompressedSize: array.length
1035910368
});
1036010369
}
1036110370

@@ -10397,7 +10406,8 @@ class ZipDirectoryEntry extends ZipEntry {
1039710406
const size = file.size;
1039810407
return { readable, size };
1039910408
},
10400-
options
10409+
options,
10410+
uncompressedSize: file.size
1040110411
});
1040210412
}
1040310413

@@ -10463,7 +10473,8 @@ class ZipDirectoryEntry extends ZipEntry {
1046310473
if (!entry.directory) {
1046410474
importedEntries.push(addChild(parent, name, {
1046510475
data: entry,
10466-
Reader: getZipBlobReader(Object.assign({}, options))
10476+
Reader: getZipBlobReader(Object.assign({}, options)),
10477+
uncompressedSize: entry.uncompressedSize
1046710478
}));
1046810479
}
1046910480
} catch (error) {
@@ -10816,10 +10827,9 @@ async function addFileSystemHandle(zipEntry, handle, options) {
1081610827
const size = file.size;
1081710828
return { readable, size };
1081810829
},
10819-
options: {
10820-
lastModDate: new Date(file.lastModified)
10821-
}
10822-
}, options)
10830+
options: Object.assign({}, { lastModDate: new Date(file.lastModified) }, options),
10831+
uncompressedSize: file.size
10832+
})
1082310833
);
1082410834
} else if (handle.kind == "directory") {
1082510835
const directoryEntry = parentEntry.addDirectory(handle.name);

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "A JavaScript library to zip and unzip files in the browser, Deno and Node.js",
44
"author": "Gildas Lormeau",
55
"license": "BSD-3-Clause",
6-
"version": "2.7.14",
6+
"version": "2.7.15",
77
"type": "module",
88
"keywords": [
99
"zip",

0 commit comments

Comments
 (0)