Skip to content

Commit 0f6720f

Browse files
committed
Fix reader issue. See Azure#28
1 parent 3af438f commit 0f6720f

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "@microsoft/fetch-event-source",
2+
"name": "@quantum-boost/fetch-event-source",
33
"version": "3.0.0",
44
"description": "A better API for making Event Source requests, with all the features of fetch()",
55
"homepage": "https://github.com/Azure/fetch-event-source#readme",
6-
"repository": "github:Azure/fetch-event-source",
7-
"bugs": {
8-
"url": "https://github.com/Azure/fetch-event-source/issues"
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/Azure/fetch-event-source.git"
99
},
1010
"author": "Microsoft",
1111
"license": "MIT",

src/parse.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ export interface EventSourceMessage {
1919
* @param onChunk A function that will be called on each new byte chunk in the stream.
2020
* @returns {Promise<void>} A promise that will be resolved when the stream closes.
2121
*/
22-
export async function getBytes(stream: ReadableStream<Uint8Array>, onChunk: (arr: Uint8Array) => void) {
23-
const reader = stream.getReader();
24-
let result: ReadableStreamReadResult<Uint8Array>;
25-
while (!(result = await reader.read()).done) {
26-
onChunk(result.value);
22+
export async function getBytes(body: any, onChunk: any) {
23+
for await (const chunk of body) {
24+
onChunk(chunk);
2725
}
2826
}
2927

0 commit comments

Comments
 (0)