Skip to content

Commit 46360a1

Browse files
committed
CFB zip compression option
fixes #600 and fixes #1638
1 parent 88225f5 commit 46360a1

File tree

5 files changed

+5
-98
lines changed

5 files changed

+5
-98
lines changed

bits/21_ziputils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function getzipbin(zip, file/*:string*/, safe/*:?boolean*/)/*:any*/ {
6161

6262
function zipentries(zip) {
6363
var k = zip.FullPaths || keys(zip.files), o = [];
64-
for(var i = 0; i < k.length; ++i) if(k[i].slice(-1) != '/') o.push(k[i]);
64+
for(var i = 0; i < k.length; ++i) if(k[i].slice(-1) != '/') o.push(k[i].replace(/^Root Entry[\/]/, ""));
6565
return o.sort();
6666
}
6767

bits/88_write.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function write_zip_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ {
4747
case "file": oopts.type = has_buf ? "nodebuffer" : "string"; break;
4848
default: throw new Error("Unrecognized type " + o.type);
4949
}
50-
var out = z.FullPaths ? CFB.write(z, {fileType:"zip", type: /*::(*/{"nodebuffer": "buffer", "string": "binary"}/*:: :any)*/[oopts.type] || oopts.type}) : z.generate(oopts);
50+
var out = z.FullPaths ? CFB.write(z, {fileType:"zip", type: /*::(*/{"nodebuffer": "buffer", "string": "binary"}/*:: :any)*/[oopts.type] || oopts.type, compression: !!o.compression}) : z.generate(oopts);
5151
if(typeof Deno !== "undefined" && typeof out == "string") out = new Uint8Array(s2ab(out));
5252
/*jshint -W083 */
5353
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o); // eslint-disable-line no-undef

mini.lst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
bits/00_header.js
22
bits/01_version.js
3-
misc/02_codepage.js
3+
bits/02_codepage.js
44
bits/03_consts.js
55
bits/04_base64.js
66
bits/05_buf.js
@@ -10,7 +10,7 @@ bits/11_ssfutils.js
1010
bits/18_cfb.js
1111
bits/19_fsutils.js
1212
bits/20_jsutils.js
13-
misc/21_ziputils.js
13+
bits/21_ziputils.js
1414
bits/22_xmlutils.js
1515
bits/23_binutils.js
1616
bits/24_hoppers.js

misc/21_ziputils.js

Lines changed: 0 additions & 93 deletions
This file was deleted.

misc/mjs.lst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ bits/11_ssfutils.js
1010
misc/18_esmcfb.js
1111
misc/19_mjsfs.js
1212
bits/20_jsutils.js
13-
misc/21_ziputils.js
13+
bits/21_ziputils.js
1414
bits/22_xmlutils.js
1515
bits/23_binutils.js
1616
bits/24_hoppers.js

0 commit comments

Comments
 (0)