Use all the arraybuffers

cuts a solid 1/3 off the compression time
This commit is contained in:
Matt 2019-04-02 16:47:38 +01:00
parent c5698fcd65
commit 8445165491
No known key found for this signature in database
GPG Key ID: 2DD462FE98BF38C2
1 changed files with 3 additions and 7 deletions

View File

@ -24,7 +24,7 @@ class Bzip2Compress extends Operation {
this.description = "Bzip2 is a compression library developed by Julian Seward (of GHC fame) that uses the Burrows-Wheeler algorithm. It only supports compressing single files and its compression is slow, however is more effective than Deflate (.gz & .zip).";
this.infoURL = "https://wikipedia.org/wiki/Bzip2";
this.inputType = "ArrayBuffer";
this.outputType = "File";
this.outputType = "ArrayBuffer";
this.args = [
{
name: "Block size (100s of kb)",
@ -35,11 +35,6 @@ class Bzip2Compress extends Operation {
name: "Work factor",
type: "number",
value: 30
},
{
name: "Compressed filename",
type: "string",
value: "compressed.bz2"
}
];
}
@ -63,7 +58,8 @@ class Bzip2Compress extends Operation {
if (bzip2cc.error !== 0) {
reject(new OperationError(bzip2cc.error_msg));
} else {
resolve(new File([bzip2cc.output], filename));
const output = bzip2cc.output;
resolve(output.buffer.slice(output.byteOffset, output.byteLength + output.byteOffset));
}
});
});