Skip to content

Commit

Permalink
Reduce the chunk size
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Edwards committed May 15, 2024
1 parent d63c9aa commit 013e54f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Crypter.Web/wwwroot/chromiumFetchTest/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,17 @@ function openStream(file) {
controller.close();
return;
}
// Get the data and send it to the browser via the controller
await wait(1000);
controller.enqueue(value);
// Use '32 * 1024' chunk size to match hard-coded .NET value
let buffer = new Uint8Array([...value]);
const chunkSize = 32 * 1024;
while (buffer.byteLength >= chunkSize) {
const chunkToSend = buffer.slice(0, chunkSize);
console.log(chunkToSend);
controller.enqueue(chunkToSend);
buffer = new Uint8Array([...buffer.slice(chunkSize)]);
}
// Check chunks by logging to the console
console.log(done, value);
console.log(done);
await push();
});
}
Expand Down

0 comments on commit 013e54f

Please sign in to comment.