Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/reader.ts>readAsText

A JavaScript extension package for building strong and modern applications.
Latest
function readAsText
import { readAsText } from "https://deno.land/x/ayonli_jsext@v0.9.72/reader.ts";

Reads all data from the given source to a string.

Examples

Example 1

import { readAsText } from "@ayonli/jsext/reader";
import { createReadableStream } from "@ayonli/jsext/fs";

const stream = createReadableStream("./package.json");
const text = await readAsText(stream);

Parameters

source:
| Blob
| ArrayBuffer
| ArrayBufferView
| AsyncIterable<Uint8Array>
| ReadableStream<Uint8Array>
optional
encoding: string | undefined = [UNSUPPORTED]

Returns

Promise<string>