-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
29 lines (27 loc) · 927 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<meta charset="UTF-8">
</head>
<body>
<h1>Test</h1>
<script>
console.log('fetch stream');
fetch('/stream').then(async response => {
console.log('response');
const reader = response.body.getReader();
while(true) {
const {done, value} = await reader.read();
if (done) {
console.log("Done!");
break;
}
// value is Uint8Array of the chunk bytes
var str = String.fromCharCode.apply(null, value);
console.log(str.length);
}
});
</script>
</body>
</html>