restructured and fixed a bug in getprevfilesize

This commit is contained in:
quarz12 2023-05-15 14:36:33 +02:00
parent 10c66b6e63
commit bc65180c32

View File

@ -8,9 +8,10 @@ class EpubParser {
getTextByteLength() { getTextByteLength() {
let size = 0; let size = 0;
for (let key in y = Object.keys(this.files)) { for (let key of Object.keys(this.files)) {
let file = this.files[y[key]]; let file = this.files[key];
if (file.name.endsWith("html")) { if (file.name.endsWith("html")) {
console.log(file.name+" "+file._data.uncompressedSize)
size += file._data.uncompressedSize; size += file._data.uncompressedSize;
} }
} }
@ -65,9 +66,10 @@ class EpubParser {
let bytesize = 0; let bytesize = 0;
for (let file of this.getSpine()) { for (let file of this.getSpine()) {
if (file !== currentFile) { if (file !== currentFile) {
let filepath = this.absPath(this.resolveIDref(currentFile)); let filepath = this.absPath(this.resolveIDref(file));
//ignore non text files //ignore non text files
if (filepath.endsWith("html")) { if (filepath.endsWith("html")) {
console.log(filepath+" "+bytesize)
bytesize += this.files[filepath]._data.uncompressedSize; bytesize += this.files[filepath]._data.uncompressedSize;
} }
} else { } else {