Module

std/streams/mod.ts>toText

Deno standard library
Go to Latest
function toText
import { toText } from "https://dotland.deno.dev/std@0.221.0/streams/mod.ts";

Converts a {@link ReadableSteam} of strings or {@link Uint8Array}s to a single string. Works the same as {@link Response.text}.

Examples

Example 1

import { toText } from "https://deno.land/std@0.221.0/streams/to_text.ts";

const stream = ReadableStream.from(["Hello, ", "world!"]);
await toText(stream); // "Hello, world!"

Parameters

readableStream: ReadableStream

Returns

Promise<string>
import toText
import { toText } from "https://dotland.deno.dev/std@0.221.0/streams/mod.ts";