mirror of
https://github.com/codedread/bitjs
synced 2025-10-03 17:49: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 {
|
else {
|
||||||
// read in the compressed data
|
// read in the compressed data
|
||||||
|
/** @type {Uint8Array} */
|
||||||
this.fileData = null;
|
this.fileData = null;
|
||||||
if (this.header.packSize > 0) {
|
if (this.header.packSize > 0) {
|
||||||
this.fileData = bstream.readBytes(this.header.packSize);
|
this.fileData = bstream.readBytes(this.header.packSize);
|
||||||
|
@ -1377,7 +1378,7 @@ function unrar() {
|
||||||
localFile.unrar();
|
localFile.unrar();
|
||||||
|
|
||||||
if (localFile.isValid) {
|
if (localFile.isValid) {
|
||||||
postMessage({ type: 'extract', unarchivedFile: localFile });
|
postMessage({ type: 'extract', unarchivedFile: localFile }, [localFile.fileData.buffer]);
|
||||||
postProgress();
|
postProgress();
|
||||||
}
|
}
|
||||||
} else if (localFile.header.packSize == 0 && localFile.header.unpackedSize == 0) {
|
} 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.
|
// Done header, now rest of blocks are the file contents.
|
||||||
this.filename = this.name;
|
this.filename = this.name;
|
||||||
|
/** @type {Uint8Array} */
|
||||||
this.fileData = null;
|
this.fileData = null;
|
||||||
|
|
||||||
info("Untarring file '" + this.filename + "'");
|
info("Untarring file '" + this.filename + "'");
|
||||||
|
@ -146,7 +147,7 @@ const untar = function () {
|
||||||
currentFileNumber = totalFilesInArchive++;
|
currentFileNumber = totalFilesInArchive++;
|
||||||
currentBytesUnarchivedInFile = oneLocalFile.size;
|
currentBytesUnarchivedInFile = oneLocalFile.size;
|
||||||
currentBytesUnarchived += oneLocalFile.size;
|
currentBytesUnarchived += oneLocalFile.size;
|
||||||
postMessage({ type: 'extract', unarchivedFile: oneLocalFile });
|
postMessage({ type: 'extract', unarchivedFile: oneLocalFile }, [oneLocalFile.fileData.buffer]);
|
||||||
postProgress();
|
postProgress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue