mirror of
https://github.com/codedread/bitjs
synced 2025-10-03 09:39:16 +02:00
Make buffers transferable out of the Worker for unrar/untar too
This commit is contained in:
parent
85dcee80ec
commit
755aba54bd
2 changed files with 4 additions and 2 deletions
|
@ -1302,6 +1302,7 @@ class RarLocalFile {
|
|||
}
|
||||
else {
|
||||
// read in the compressed data
|
||||
/** @type {Uint8Array} */
|
||||
this.fileData = null;
|
||||
if (this.header.packSize > 0) {
|
||||
this.fileData = bstream.readBytes(this.header.packSize);
|
||||
|
@ -1377,7 +1378,7 @@ function unrar() {
|
|||
localFile.unrar();
|
||||
|
||||
if (localFile.isValid) {
|
||||
postMessage({ type: 'extract', unarchivedFile: localFile });
|
||||
postMessage({ type: 'extract', unarchivedFile: localFile }, [localFile.fileData.buffer]);
|
||||
postProgress();
|
||||
}
|
||||
} else if (localFile.header.packSize == 0 && localFile.header.unpackedSize == 0) {
|
||||
|
|
|
@ -100,6 +100,7 @@ class TarLocalFile {
|
|||
|
||||
// Done header, now rest of blocks are the file contents.
|
||||
this.filename = this.name;
|
||||
/** @type {Uint8Array} */
|
||||
this.fileData = null;
|
||||
|
||||
info("Untarring file '" + this.filename + "'");
|
||||
|
@ -146,7 +147,7 @@ const untar = function () {
|
|||
currentFileNumber = totalFilesInArchive++;
|
||||
currentBytesUnarchivedInFile = oneLocalFile.size;
|
||||
currentBytesUnarchived += oneLocalFile.size;
|
||||
postMessage({ type: 'extract', unarchivedFile: oneLocalFile });
|
||||
postMessage({ type: 'extract', unarchivedFile: oneLocalFile }, [oneLocalFile.fileData.buffer]);
|
||||
postProgress();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue