import { StringWriter } from "https://deno.land/std@0.197.0/io/string_writer.ts";
Writer utility for buffering string chunks.
Examples
Example 1
Example 1
import {
copyN,
StringReader,
StringWriter,
} from "https://deno.land/std@0.197.0/io/mod.ts";
import { copy } from "https://deno.land/std@0.197.0/streams/copy.ts";
const w = new StringWriter("base");
const r = new StringReader("0123456789");
await copyN(r, w, 4); // copy 4 bytes
// Number of bytes read
console.log(w.toString()); //base0123
await copy(r, w); // copy all
console.log(w.toString()); // base0123456789
Output:
base0123
base0123456789