Skip to content

Commit 3444125

Browse files
committed
☕ Follow the latest Deno API changes
1 parent 1e72763 commit 3444125

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

.scripts/utils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import * as streams from "https://deno.land/std@0.214.0/streams/mod.ts";
55
* Throws error if fetch fails.
66
*/
77
export async function downloadString(url: string): Promise<string> {
8-
const textDecoder = new TextDecoder();
98
const response = await fetch(url);
109
if (!response.body) {
1110
throw new Error(`Failed to read ${url}`);
1211
}
13-
const reader = streams.readerFromStreamReader(response.body.getReader());
14-
return textDecoder.decode(await streams.readAll(reader));
12+
//const reader = streams.readerFromStreamReader(response.body.getReader());
13+
return await streams.toText(response.body);
1514
}
1615

1716
/**

0 commit comments

Comments
 (0)