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

x/silicon/deps_deprecated.ts>io.StringReader

Deno module to generate images from source code using Aloxaf/silicon.
Latest
class io.StringReader
extends Buffer
Deprecated
Deprecated

(will be removed after 1.0.0) Use Web Streams instead.

import { io } from "https://deno.land/x/silicon@v1.0.0/deps_deprecated.ts";
const { StringReader } = io;

Reader utility for strings.

Examples

Example 1

import { StringReader } from "https://deno.land/std@0.224.0/io/string_reader.ts";

const data = new Uint8Array(6);
const r = new StringReader("abcdef");
const res0 = await r.read(data);
const res1 = await r.read(new Uint8Array(6));

// Number of bytes read
console.log(res0); // 6
console.log(res1); // null, no byte left to read. EOL

// text

console.log(new TextDecoder().decode(data)); // abcdef

Output:

6
null
abcdef

Constructors

new
StringReader(s: string)