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

feat(streams): ByteSliceStream #2795

Merged
merged 10 commits into from
Nov 3, 2022
Merged

feat(streams): ByteSliceStream #2795

merged 10 commits into from
Nov 3, 2022

Conversation

iuioiua
Copy link
Contributor

@iuioiua iuioiua commented Oct 19, 2022

This PR adds ByteSliceStream, which is the streams version of readRange from std/io.

Part of #1986.

streams/buffer.ts Outdated Show resolved Hide resolved
streams/buffer.ts Outdated Show resolved Hide resolved
streams/buffer.ts Outdated Show resolved Hide resolved
streams/buffer.ts Outdated Show resolved Hide resolved
@kt3k
Copy link
Member

kt3k commented Oct 27, 2022

How about dropping Transform from the class name?

Many TransformStream APIs don't have Transform in their name.

  • TextDecoderStream, TextEncoderStream, CompressionStream, DecompressionStream from Web API
  • CsvStream, JSONParseStream, JSONStrigifyStream, TextLineStream, DelimiterStream from std

(LimitedTransformStream and LimitedBytesTransformStream look rather exceptions.)

I also suggest using Slice instead of Ranged. How about ByteSliceStream or SliceByteStream?

@iuioiua iuioiua changed the title feat(streams): RangedByteTransformStream feat(streams): SliceBytesStream Oct 29, 2022
@iuioiua
Copy link
Contributor Author

iuioiua commented Oct 29, 2022

Thanks for the suggestions! @cjihrig, does the code make a bit more sense now? @kt3k, I've gone with ByteSliceStream.

@iuioiua iuioiua changed the title feat(streams): SliceBytesStream feat(streams): ByteSliceStream Oct 31, 2022
streams/buffer.ts Show resolved Hide resolved
@timreichen
Copy link
Contributor

@kt3k How about just SliceStream?

@iuioiua
Copy link
Contributor Author

iuioiua commented Nov 2, 2022

@timreichen, I think that's best reserved for the non-binary-data version of this class.

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

@kt3k
Copy link
Member

kt3k commented Nov 3, 2022

We internally chatted about the name candidates. ByteSliceStream seemed having enough support.

@kt3k kt3k merged commit b25e580 into denoland:main Nov 3, 2022
@iuioiua iuioiua deleted the RangedByteTransformStream branch November 3, 2022 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants