mirror of
https://github.com/codedread/bitjs
synced 2025-10-06 02:39:55 +02:00
Add logging as a parameter (used in unzip.js). Add a TODO for unrar.js to use a ByteStream for the file headers
This commit is contained in:
parent
950dc65b56
commit
b04e638c93
4 changed files with 47 additions and 22 deletions
|
@ -7,6 +7,10 @@
|
|||
* Copyright(c) 2011 antimatter15
|
||||
*/
|
||||
|
||||
// TODO: Rewrite the RarLocalHeader parsing to use a ByteStream instead
|
||||
// of a BitStream so that it throws properly when not enough bytes are
|
||||
// present.
|
||||
|
||||
// This file expects to be invoked as a Worker (see onmessage below).
|
||||
importScripts('../io/bitstream.js');
|
||||
importScripts('../io/bytebuffer.js');
|
||||
|
@ -24,6 +28,7 @@ const UnarchiveState = {
|
|||
let unarchiveState = UnarchiveState.NOT_STARTED;
|
||||
let bitstream = null;
|
||||
let allLocalFiles = null;
|
||||
let logToConsole = false;
|
||||
|
||||
// Progress variables.
|
||||
let currentFilename = "";
|
||||
|
@ -1378,6 +1383,7 @@ function unrar() {
|
|||
// event.data.bytes has all subsequent ArrayBuffers.
|
||||
onmessage = function(event) {
|
||||
const bytes = event.data.file || event.data.bytes;
|
||||
logToConsole = !!event.data.logToConsole;
|
||||
|
||||
// This is the very first time we have been called. Initialize the bytestream.
|
||||
if (!bitstream) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue