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

x/s3si/deps.ts>io.StringWriter

Export your battles from SplatNet to https://stat.ink
Go to Latest
class io.StringWriter
implements Writer, WriterSync
Deprecated
Deprecated

(will be removed after 1.0.0) Use the [Web Streams API]https://developer.mozilla.org/en-US/docs/Web/API/Streams_API instead.

import { io } from "https://deno.land/x/s3si@gui-v0.4.16/deps.ts";
const { StringWriter } = io;

Writer utility for buffering string chunks.

Examples

Example 1

import {
  copyN,
  StringReader,
  StringWriter,
} from "https://deno.land/std@0.224.0/io/mod.ts";
import { copy } from "https://deno.land/std@0.224.0/io/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

Constructors

new
StringWriter(base?: string)

Methods

toString(): string
write(p: Uint8Array): Promise<number>
writeSync(p: Uint8Array): number