fs: add support for getting actual file size

This commit is contained in:
Abdullah Atta
2023-05-24 15:49:21 +05:00
committed by Abdullah Atta
parent 1a0c94896a
commit 85484b1762

View File

@@ -92,4 +92,14 @@ export default class FileHandle {
}
return new Blob(blobParts, { type: this.file.type });
}
async size() {
let size = 0;
for (let i = 0; i < this.file.chunks; ++i) {
const array = await this.readChunk(i);
if (!array) continue;
size += array.length;
}
return size;
}
}