Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/hub/src/utils/XetBlob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,11 @@ export class XetBlob extends Blob {
totalFetchBytes += result.value.byteLength;

if (leftoverBytes) {
result.value = new Uint8Array([...leftoverBytes, ...result.value]);
leftoverBytes = undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the leftoverBytes = undefined part is important

Copy link
Member

@coyotte508 coyotte508 Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also make the function into a combineUint8Arrays helper? ( a dedicated file in this folder)

const leftoverBytesLength: number = leftoverBytes.length;
const combinedBytes = new Uint8Array(leftoverBytesLength + result.value.length);
combinedBytes.set(leftoverBytes);
combinedBytes.set(result.value, leftoverBytesLength);
result.value = combinedBytes;
}

while (totalBytesRead < maxBytes && result.value.byteLength) {
Expand Down