Skip to main content

@std/io@0.225.0

UNSTABLE: The utilities for advanced I/O operations using Reader and Writer interfaces.

This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
88%
Published
3 months ago (0.225.0)
interface ReaderSync

An abstract interface which when implemented provides an interface to read bytes into an array buffer synchronously.

Methods

Reads up to p.byteLength bytes into p. It resolves to the number of bytes read (0 < n <= p.byteLength) and rejects if any error encountered. Even if read() returns n < p.byteLength, it may use all of p as scratch space during the call. If some data is available but not p.byteLength bytes, read() conventionally returns what is available instead of waiting for more.

When readSync() encounters end-of-file condition, it returns EOF (null).

When readSync() encounters an error, it throws with an error.

Callers should always process the n > 0 bytes returned before considering the EOF (null). Doing so correctly handles I/O errors that happen after reading some bytes and also both of the allowed EOF behaviors.

Implementations should not retain a reference to p.

Use @std/io/to-iterator.ts?s=toIteratorSync to turn a ReaderSync into an IterableIterator.

Add Package

deno add jsr:@std/io

Import symbol

import { type ReaderSync } from "@std/io/types";

---- OR ----

Import directly with a jsr specifier

import { type ReaderSync } from "jsr:@std/io/types";

Add Package

npx jsr add @std/io

Import symbol

import { type ReaderSync } from "@std/io/types";

Add Package

yarn dlx jsr add @std/io

Import symbol

import { type ReaderSync } from "@std/io/types";

Add Package

pnpm dlx jsr add @std/io

Import symbol

import { type ReaderSync } from "@std/io/types";

Add Package

bunx jsr add @std/io

Import symbol

import { type ReaderSync } from "@std/io/types";