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(streams): remove iterateReader, readableStreamFromReader, readerFromIterable, readerFromStreamReader, writableStreamFromWriter, and writerFromStreamWriter #5060

Merged
merged 3 commits into from
Jun 17, 2024

Conversation

kt3k
Copy link
Member

@kt3k kt3k commented Jun 17, 2024

This PR removes deprecated APIs in @std/streams

What's changed

iterateReader, readableStreamFromReader, readerFromStreamReader, writableStreamFromWriter, and writerFromStreamWriter are removed in favor of the similar APIs in @std/io.

readerFromIterable are removed in favor of the combination of readerFromStreamReader(ReadableStream.from().getReader()).

Why was this change been made?

We are in the process of migrating from Reader/Writer based I/O APIs to Web Stream I/O APIs. As part of that process, we decided to move all Reader/Writer related APIs to std/io.

Now std/streams has helpers for Web Streams APIs. This is now recommended way to perform IO in Deno.

All APIs in std/io are related to legacy Reader/Writer based APIs. These are now not recommended way to perform IO in Deno.

This move tries to make the above distinction of 2 sets of APIs clear.

Migration

Import these from std/io

-import {
-  iterateReader,
-  readableStreamFromReader,
-  readerFromStreamReader,
-  writableStreamFromWriter,
-  writerFromStreamWriter
-} from "@std/streams";
+import {
+  iterateReader,
+  toReadableStream as readableStreamFromReader,
+  readerFromStreamReader,
+  toWritableStream as writableStreamFromWriter,
+  writerFromStreamWriter
+} from "@std/io";

For readerFromIterable(iter), use readerFromStreamReader(ReadablerStream.from(iter).getReader())

kt3k added 2 commits June 17, 2024 14:47
…, `readerFromIterable`, `readerFromStreamReader`, `writableStreamFromWriter`, and `writerFromStreamWriter`
Copy link

codecov bot commented Jun 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.22%. Comparing base (935d665) to head (b346bb6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5060      +/-   ##
==========================================
- Coverage   92.22%   92.22%   -0.01%     
==========================================
  Files         487      481       -6     
  Lines       38859    38757     -102     
  Branches     5444     5436       -8     
==========================================
- Hits        35838    35742      -96     
+ Misses       2966     2960       -6     
  Partials       55       55              

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

Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

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

LGTM once nit is addressed.

@@ -45,7 +44,7 @@ Deno.test("iterateReader()", async () => {
Deno.test("iterateReader() works with slow consumer", async () => {
const a = new Uint8Array([97]);
const b = new Uint8Array([98]);
const iter = iterateReader(readerFromIterable([a, b]));
const iter = ReadableStream.from([a, b]);
Copy link
Contributor

Choose a reason for hiding this comment

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

This test for iterateReader() no longer uses iterateReader().

@kt3k
Copy link
Member Author

kt3k commented Jun 17, 2024

The next version of streams is planned to be 1.0.0-rc.1 (#4600). Landing this now.

@kt3k kt3k merged commit 4837997 into denoland:main Jun 17, 2024
12 checks passed
@kt3k kt3k deleted the remove-streams-deprecated-apis branch June 17, 2024 10:02
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