Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bongbui321 committed Apr 21, 2024
1 parent 6bba97b commit 3f9c8c1
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/QDL/imageProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export async function* unsparsify(image, maxYieldSize=MAX_YIELD_SIZE) {
if (header === null) {
throw "Invalid sparse image";
}
const rawHash = new jsSHA('SHA-256', 'UINT8ARRAY');

for (let i = 0; i < header.totalChunks; i++) {
const chunkHeader = parseChunkHeader(await downloader.read(CHUNK_HEADER_SIZE));
Expand Down Expand Up @@ -145,8 +144,7 @@ export async function* unsparsify(image, maxYieldSize=MAX_YIELD_SIZE) {
let byteToSend = chunkHeader.blocks * blockSize;
while (byteToSend > 0) {
const wlen = Math.min(maxYieldSize, byteToSend);
const wData = new Uint8Array(wlen).fill(0);
yield wData;
yield new Uint8Array(wlen).fill(0);
byteToSend -= wlen
}
} else {
Expand All @@ -160,8 +158,7 @@ export async function* unsparsify(image, maxYieldSize=MAX_YIELD_SIZE) {
export async function* noop(image, maxYieldSize=MAX_YIELD_SIZE) {
const downloader = new streamingDecompressor(image.archiveUrl);
while (!downloader.eof) {
const wData = await downloader.read(maxYieldSize);
yield wData;
yield await downloader.read(maxYieldSize);
}
checkPartitionHash(downloader.shaObj.getHash('HEX'), image.checksum);
}
Expand Down

0 comments on commit 3f9c8c1

Please sign in to comment.