Skip to content

Commit 6a1a23c

Browse files
author
jarvisjiang
committed
docs(codebuddy): update progress tracking description
Replace outdated stream.tee() references with response.clone() which reflects the actual implementation since v1.6.0.
1 parent 767d5d3 commit 6a1a23c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

CODEBUDDY.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,10 @@ src/
139139
- Use `.isOk()`, `.isErr()`, `.unwrap()`, `.unwrapErr()` for conditional handling
140140
- Example: `result.inspect(data => console.log(data)).inspectErr(err => console.error(err))`
141141

142-
3. **Stream Multiplexing**
143-
- Uses `ReadableStream.tee()` to split response streams
144-
- One stream for progress/chunk tracking, another for response body parsing
145-
- Enables progress callbacks without consuming the response
146-
- Creates a new Response object with the teed stream to maintain compatibility
142+
3. **Response Cloning for Progress Tracking**
143+
- Uses `response.clone()` to create a separate copy for progress/chunk tracking
144+
- Original response is used for body parsing, clone is consumed for progress
145+
- Enables progress callbacks without affecting the response consumption
147146

148147
4. **Timeout Mechanism**
149148
- Uses `AbortSignal.timeout()` for timeout implementation (modern browser API)
@@ -364,7 +363,7 @@ Network failures and HTTP errors are wrapped in `Result` type via `happy-rusty`.
364363

365364
1. **Progress tracking requires Content-Length header**: If the server doesn't send this header, progress tracking will fail (onProgress receives an Err). The `Headers.get()` method is case-insensitive per the HTTP spec.
366365

367-
2. **Stream tee() limitation**: Progress/chunk callbacks add overhead due to stream splitting. Each chunk is read twice - once for tracking, once for parsing.
366+
2. **Response cloning overhead**: Progress/chunk callbacks clone the response, which may have memory implications for very large responses.
368367

369368
3. **Import extensions**: Source code uses `.ts` extensions in imports which is non-standard but enabled by TypeScript bundler mode.
370369

0 commit comments

Comments
 (0)