0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-29 08:58:01 -04:00

docs: fix naming in std/io usage example (#8700)

Co-authored-by: tomholford <tomholford@users.noreply.github.com>
This commit is contained in:
tomholford 2020-12-09 19:22:09 -08:00 committed by GitHub
parent 1a72c9ba23
commit 7cc7f1719b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -126,26 +126,26 @@ base0123456789
## Streams
### fromStreamReader
### readerFromStreamReader
Creates a `Reader` from a `ReadableStreamDefaultReader`.
```ts
import { fromStreamReader } from "https://deno.land/std@$STD_VERSION/io/mod.ts";
import { readerFromStreamReader } from "https://deno.land/std@$STD_VERSION/io/mod.ts";
const res = await fetch("https://deno.land");
const file = await Deno.open("./deno.land.html", { create: true, write: true });
const reader = fromStreamReader(res.body!.getReader());
const reader = readerFromStreamReader(res.body!.getReader());
await Deno.copy(reader, file);
file.close();
```
### fromStreamWriter
### writerFromStreamWriter
Creates a `Writer` from a `WritableStreamDefaultWriter`.
```ts
import { fromStreamWriter } from "https://deno.land/std@$STD_VERSION/io/mod.ts";
import { writerFromStreamWriter } from "https://deno.land/std@$STD_VERSION/io/mod.ts";
const file = await Deno.open("./deno.land.html", { read: true });
const writableStream = new WritableStream({
@ -153,7 +153,7 @@ const writableStream = new WritableStream({
console.log(chunk);
},
});
const writer = fromStreamWriter(writableStream.getWriter());
const writer = writerFromStreamWriter(writableStream.getWriter());
await Deno.copy(file, writer);
file.close();
```