Skip to main content

@std/io@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Published2 years ago (0.215.0)
class StringWriter
implements Writer, WriterSync
Deprecated

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

Writer utility for buffering string chunks.

Examples

Example 1

import {
  copyN,
  StringReader,
  StringWriter,
} from "@std/io";
import { copy } from "@std/io/copy";

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

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/io

Import symbol

import { StringWriter } from "@std/io/string_writer";
or

Import directly with a jsr specifier

import { StringWriter } from "jsr:@std/io/string_writer";