fix(core): Improve streaming support and timeout handling; add browser streaming & timeout tests and README clarifications

This commit is contained in:
2025-08-19 01:36:44 +00:00
parent 35867d9148
commit 361d97f440
8 changed files with 181 additions and 11 deletions

View File

@@ -379,15 +379,20 @@ async function uploadBinaryData() {
#### Streaming Methods
- **`.buffer(data, contentType?)`** - Stream a Buffer or Uint8Array directly
- `data`: Buffer or Uint8Array to send
- `data`: Buffer (Node.js) or Uint8Array (both platforms) to send
- `contentType`: Optional content type (defaults to 'application/octet-stream')
- ✅ Works in both Node.js and browsers
- **`.stream(stream, contentType?)`** - Stream from Node.js ReadableStream or web ReadableStream
- `stream`: The stream to pipe to the request
- **`.stream(stream, contentType?)`** - Stream from ReadableStream
- `stream`: Web ReadableStream (both platforms) or Node.js stream (Node.js only)
- `contentType`: Optional content type
- ✅ Web ReadableStream works in both Node.js and browsers
- ⚠️ Node.js streams only work in Node.js environment
- **`.raw(streamFunc)`** - Advanced control over request streaming (Node.js only)
- **`.raw(streamFunc)`** - Advanced control over request streaming
- `streamFunc`: Function that receives the raw request object for custom streaming
-**Node.js only** - not supported in browsers
- Use for advanced scenarios like chunked transfer encoding
These methods are particularly useful for:
- Uploading large files without loading them into memory