Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING(io): remove BufReader #6056

Merged
merged 2 commits into from
Sep 25, 2024
Merged

BREAKING(io): remove BufReader #6056

merged 2 commits into from
Sep 25, 2024

Conversation

iuioiua
Copy link
Contributor

@iuioiua iuioiua commented Sep 25, 2024

What's changed

BufReader has been removed from @std/io.

Motivation

This change was made to help push users towards using the Streams API and @std/streams, and make design decisions about which APIs easier.

Migration guide

To migrate, use Buffer from @std/streams instead. If you have any use cases which lack a clear means of migration, open an issue.

Before:

import { Buffer, BufReader } from "@std/io";
import { assertEquals } from "@std/assert/equals";

const encoder = new TextEncoder();
const decoder = new TextDecoder();

const reader = new BufReader(new Buffer(encoder.encode("Hello, world!")));
const buffer = new Uint8Array(11);
await reader.read(buffer);
const result = decoder.decode(buffer);

assertEquals(result, "Hello, world!");

After:

import { Buffer } from "@std/streams/buffer";
import { toText } from "@std/streams/to-text";
import { assertEquals } from "@std/assert";

const encoder = new TextEncoder();

const buffer = new Buffer(encoder.encode("Hello, world!"));
const result = await toText(buffer.readable);

assertEquals(result, "Hello, world!");

Related

Towards #5989

@iuioiua iuioiua requested a review from kt3k as a code owner September 25, 2024 04:29
@github-actions github-actions bot added the io label Sep 25, 2024
Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@iuioiua iuioiua merged commit 0023c53 into main Sep 25, 2024
17 checks passed
@iuioiua iuioiua deleted the remove-BufReader branch September 25, 2024 07:52
eryue0220 added a commit to eryue0220/deno_std that referenced this pull request Sep 26, 2024
…deno_std into feat/expect-object-containing

* 'feat/expect-object-containing' of github.com:eryue0220/deno_std:
  BREAKING(io): remove `StringReader` (denoland#6062)
  BREAKING(io): remove `StringWriter` (denoland#6061)
  BREAKING(io): remove `MultiReader` (denoland#6059)
  BREAKING(io): remove `LimitedReader` (denoland#6058)
  chore: fix heading level in Releases.md (denoland#6044)
  BREAKING(io): remove `readDelim()` (denoland#6052)
  BREAKING(io): remove `BufWriter` (denoland#6057)
  BREAKING(io): remove `BufReader` (denoland#6056)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants