mirror of
https://github.com/codedread/bitjs
synced 2025-10-03 17:49:16 +02:00
Track number of compressed bytes read in while unarchiving and reporting progress
This commit is contained in:
parent
8c630c170c
commit
23e3921072
4 changed files with 13 additions and 4 deletions
|
@ -104,9 +104,11 @@ bitjs.archive.UnarchiveProgressEvent = class extends bitjs.archive.UnarchiveEven
|
|||
* @param {number} currentBytesUnarchived
|
||||
* @param {number} totalUncompressedBytesInArchive
|
||||
* @param {number} totalFilesInArchive
|
||||
* @param {number} totalCompressedBytesRead
|
||||
*/
|
||||
constructor(currentFilename, currentFileNumber, currentBytesUnarchivedInFile,
|
||||
currentBytesUnarchived, totalUncompressedBytesInArchive, totalFilesInArchive) {
|
||||
currentBytesUnarchived, totalUncompressedBytesInArchive, totalFilesInArchive,
|
||||
totalCompressedBytesRead) {
|
||||
super(bitjs.archive.UnarchiveEvent.Type.PROGRESS);
|
||||
|
||||
this.currentFilename = currentFilename;
|
||||
|
@ -115,6 +117,7 @@ bitjs.archive.UnarchiveProgressEvent = class extends bitjs.archive.UnarchiveEven
|
|||
this.totalFilesInArchive = totalFilesInArchive;
|
||||
this.currentBytesUnarchived = currentBytesUnarchived;
|
||||
this.totalUncompressedBytesInArchive = totalUncompressedBytesInArchive;
|
||||
this.totalCompressedBytesRead = totalCompressedBytesRead;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,9 @@ const postProgress = function() {
|
|||
currentBytesUnarchivedInFile,
|
||||
currentBytesUnarchived,
|
||||
totalUncompressedBytesInArchive,
|
||||
totalFilesInArchive));
|
||||
totalFilesInArchive,
|
||||
parseInt(bitstream.getNumBitsRead() / 8, 10),
|
||||
));
|
||||
};
|
||||
|
||||
// shows a byte value as its hex representation
|
||||
|
|
|
@ -48,7 +48,9 @@ const postProgress = function() {
|
|||
currentBytesUnarchivedInFile,
|
||||
currentBytesUnarchived,
|
||||
totalUncompressedBytesInArchive,
|
||||
totalFilesInArchive));
|
||||
totalFilesInArchive,
|
||||
bytestream.getNumBytesRead(),
|
||||
));
|
||||
};
|
||||
|
||||
// Removes all characters from the first zero-byte in the string onwards.
|
||||
|
|
|
@ -52,7 +52,9 @@ const postProgress = function() {
|
|||
currentBytesUnarchivedInFile,
|
||||
currentBytesUnarchived,
|
||||
totalUncompressedBytesInArchive,
|
||||
totalFilesInArchive));
|
||||
totalFilesInArchive,
|
||||
bytestream.getNumBytesRead(),
|
||||
));
|
||||
};
|
||||
|
||||
const zLocalFileHeaderSignature = 0x04034b50;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue