minor
This commit is contained in:
parent
b716980d1b
commit
3fea520546
3 changed files with 0 additions and 33512 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,31 +0,0 @@
|
||||||
<!doctype html>
|
|
||||||
<script>
|
|
||||||
|
|
||||||
async function init() {
|
|
||||||
const response = await fetch('long.txt');
|
|
||||||
const reader = response.body.getReader();
|
|
||||||
|
|
||||||
const contentLength = +response.headers.get('Content-Length');
|
|
||||||
let receivedLength = 0;
|
|
||||||
|
|
||||||
while(true) {
|
|
||||||
const chunk = await reader.read();
|
|
||||||
|
|
||||||
if (chunk.done) {
|
|
||||||
console.log("done!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
receivedLength += chunk.value.length;
|
|
||||||
console.log(`${receivedLength}/${contentLength} received`)
|
|
||||||
}
|
|
||||||
|
|
||||||
let result = await response.text();
|
|
||||||
console.log(result);
|
|
||||||
//const chunkCount = await read(reader);
|
|
||||||
//console.log(`Finished! Received ${chunkCount} chunks.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
init();
|
|
||||||
|
|
||||||
</script>
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue