Skip to content

Commit

Permalink
docs: fix naming in io usage example (denoland/deno#8700)
Browse files Browse the repository at this point in the history
Co-authored-by: tomholford <[email protected]>
  • Loading branch information
2 people authored and denobot committed Feb 1, 2021
1 parent 0ec35e8 commit ec1e44b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions io/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,34 +126,34 @@ 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({
write(chunk): void {
console.log(chunk);
},
});
const writer = fromStreamWriter(writableStream.getWriter());
const writer = writerFromStreamWriter(writableStream.getWriter());
await Deno.copy(file, writer);
file.close();
```

0 comments on commit ec1e44b

Please sign in to comment.