Repository navigation
Conversation
…m, update docs, bump to v3.0.0 Co-authored-by: Hexagon <419737+Hexagon@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add cross runtime support for streaming encoding and decoding
Add streaming base64 encode/decode via TransformStream
Nov 19, 2025
There was a problem hiding this comment.
🟡 Changes recommended
Formatting fails CI, decoder boundary coverage is incomplete, and examples use an API unavailable in the documented runtime range.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds Web Streams-based Base64 encoding and decoding while preserving standard and URL-safe modes.
Changes:
- Adds encoder and decoder
TransformStreamclasses. - Adds streaming tests and usage documentation.
- Bumps the package to version 3.0.0.
File summaries
| File | Description |
|---|---|
src/base64.ts |
Implements and exports streaming APIs. |
tests/base64.test.ts |
Adds streaming behavior tests. |
README.md |
Lists streaming APIs and compatibility. |
docs/index.md |
Documents stream classes and usage. |
docs/examples.md |
Adds streaming examples. |
deno.json |
Bumps the package version. |
Review details
Suppressed comments (3)
tests/base64.test.ts:222
- This “multiple chunks” case splits only on four-character boundaries, so it never exercises the decoder's new buffering across a quartet boundary. Use deliberately unaligned chunks so a regression in
buffercarry-over is detected.
const chunks = ["SGVs", "bG8g", "d29y", "bGQ="];
docs/examples.md:66
ReadableStream.from()is unavailable before Node.js v20.6.0, despite the documented v16.5.0 minimum. Use the baseline stream constructor so this decoding example works on supported Node.js versions.
const decodedStream = ReadableStream.from([base64Data])
.pipeThrough(decoder);
docs/examples.md:84
- This URL-mode example also relies on
ReadableStream.from(), which requires Node.js v20.6.0 rather than the advertised v16.5.0. Build the source with the standard constructor to preserve the stated compatibility.
const urlEncodedStream = ReadableStream.from([textData])
.pipeThrough(urlEncoder);
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const reader = ReadableStream.from([new TextEncoder().encode("Hello world")]) | ||
| .pipeThrough(encoder) | ||
| .getReader(); | ||
|
|
Comment on lines
+54
to
+55
| const encodedStream = ReadableStream.from([textData]) | ||
| .pipeThrough(encoder); |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds memory-efficient streaming support for base64 encoding and decoding using Web Streams API.
Changes
New Classes
Base64EncoderStream-TransformStream<Uint8Array, string>for streaming encodeBase64DecoderStream-TransformStream<string, Uint8Array>for streaming decodeurlModeparameterImplementation
TransformStreamDocumentation
Usage
Compatibility
Node.js 16.5+, Deno 1.16+, Bun, modern browsers (all with native TransformStream support).
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.