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 StringReader #6062

Merged
merged 3 commits into from
Sep 26, 2024
Merged

BREAKING(io): remove StringReader #6062

merged 3 commits into from
Sep 26, 2024

Conversation

iuioiua
Copy link
Contributor

@iuioiua iuioiua commented Sep 26, 2024

What's changed

StringReader is being 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 to use easier.

Migration guide

To migrate, read from a Buffer's readable property instead. If you have any use cases which lack a clear means of migration, open an issue.

Before:

import { StringReader } from "https://deno.land/[email protected]/io/string_reader.ts";

const data = new Uint8Array(6);
const reader = new StringReader("abcdef");
await reader.read(data);

console.log(new TextDecoder().decode(data)); // "abcdef"

After:

import { Buffer } from "@std/streams/buffer";

const buffer = new Buffer(new TextEncoder().encode("abcdef"));

const { value } = await buffer.readable.getReader().read();
console.log(new TextDecoder().decode(value)); // "abcdef"

Related

Towards #5989

@iuioiua iuioiua requested a review from kt3k as a code owner September 26, 2024 02:19
@iuioiua iuioiua enabled auto-merge (squash) September 26, 2024 02:19
@github-actions github-actions bot added the io label Sep 26, 2024
Copy link

codecov bot commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.76%. Comparing base (87a5b9e) to head (17b6b2c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6062   +/-   ##
=======================================
  Coverage   96.75%   96.76%           
=======================================
  Files         509      508    -1     
  Lines       39113    39101   -12     
  Branches     5786     5787    +1     
=======================================
- Hits        37845    37836    -9     
+ Misses       1228     1225    -3     
  Partials       40       40           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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 d902c24 into main Sep 26, 2024
16 checks passed
@iuioiua iuioiua deleted the remove-StringReader branch September 26, 2024 03:25
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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants