Skip to content
New issue

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

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

Already on GitHub? # to your account

simplify WritableStream example #38536

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

simplify WritableStream example #38536

wants to merge 1 commit into from

Conversation

phoddie
Copy link

@phoddie phoddie commented Mar 8, 2025

Description

The example is needlessly complex. It converts a string to a Uint8Array, then writes each byte of the array separately, and reconstructs the message later. It could simply send the string. Streams are confusing enough. The examples shouldn't add to that.

Motivation

I want developers to be able to understand essential concepts of streams and JavaScript clearly.

Additional details

The example refers to the bytes within a Uint8Array as "chunks". They are just numbers. This is confusing. The confusion is eliminated by simply writing the message as a string to the stream.

@phoddie phoddie requested a review from a team as a code owner March 8, 2025 23:59
@phoddie phoddie requested review from wbamberg and removed request for a team March 8, 2025 23:59
@github-actions github-actions bot added Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels Mar 9, 2025
Copy link
Contributor

github-actions bot commented Mar 9, 2025

Preview URLs

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant