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

x/proc/legacy/deps.ts>BufWriterSync

A high-level way to run child processes that is easy, flexible, powerful, and prevents resource leaks.
Go to Latest
class BufWriterSync
implements WriterSync
extends AbstractBufBase
import { BufWriterSync } from "https://deno.land/x/proc@0.20.17/legacy/deps.ts";

BufWriterSync implements buffering for a deno.WriterSync object. If an error occurs writing to a WriterSync, no more data will be accepted and all subsequent writes, and flush(), will return the error. After all data has been written, the client should call the flush() method to guarantee all data has been forwarded to the underlying deno.WriterSync.

Constructors

new
BufWriterSync(writer: WriterSync, size?: number)

Methods

Flush writes any buffered data to the underlying io.WriterSync.

Discards any unflushed buffered data, clears any error, and resets buffer to write its output to w.

writeSync(data: Uint8Array): number

Writes the contents of data into the buffer. If the contents won't fully fit into the buffer, those bytes that can are copied into the buffer, the buffer is the flushed to the writer and the remaining bytes are copied into the now empty buffer.

Static Methods

create(writer: WriterSync, size?: number): BufWriterSync

return new BufWriterSync unless writer is BufWriterSync