Skip to content

Commit

Permalink
CFB zip compression option
Browse files Browse the repository at this point in the history
fixes #600 and fixes #1638
  • Loading branch information
reviewher committed Feb 12, 2022
1 parent 88225f5 commit 46360a1
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 98 deletions.
2 changes: 1 addition & 1 deletion bits/21_ziputils.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function getzipbin(zip, file/*:string*/, safe/*:?boolean*/)/*:any*/ {

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

Expand Down
2 changes: 1 addition & 1 deletion bits/88_write.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function write_zip_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ {
case "file": oopts.type = has_buf ? "nodebuffer" : "string"; break;
default: throw new Error("Unrecognized type " + o.type);
}
var out = z.FullPaths ? CFB.write(z, {fileType:"zip", type: /*::(*/{"nodebuffer": "buffer", "string": "binary"}/*:: :any)*/[oopts.type] || oopts.type}) : z.generate(oopts);
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);
if(typeof Deno !== "undefined" && typeof out == "string") out = new Uint8Array(s2ab(out));
/*jshint -W083 */
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o); // eslint-disable-line no-undef
Expand Down
4 changes: 2 additions & 2 deletions mini.lst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
bits/00_header.js
bits/01_version.js
misc/02_codepage.js
bits/02_codepage.js
bits/03_consts.js
bits/04_base64.js
bits/05_buf.js
Expand All @@ -10,7 +10,7 @@ bits/11_ssfutils.js
bits/18_cfb.js
bits/19_fsutils.js
bits/20_jsutils.js
misc/21_ziputils.js
bits/21_ziputils.js
bits/22_xmlutils.js
bits/23_binutils.js
bits/24_hoppers.js
Expand Down
93 changes: 0 additions & 93 deletions misc/21_ziputils.js

This file was deleted.

2 changes: 1 addition & 1 deletion misc/mjs.lst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bits/11_ssfutils.js
misc/18_esmcfb.js
misc/19_mjsfs.js
bits/20_jsutils.js
misc/21_ziputils.js
bits/21_ziputils.js
bits/22_xmlutils.js
bits/23_binutils.js
bits/24_hoppers.js
Expand Down

0 comments on commit 46360a1

Please sign in to comment.