Files
bun.sh/test/regression
Claude Bot d01fa4f193 Fix hang when writing custom ReadableStreams to files
When writing a Response or Request with a locked body (streaming)
to a file using Bun.write(), the operation would hang indefinitely.
This occurred because the locked body was never converted to a
ReadableStream and piped to the file destination.

The fix ensures that:
1. Locked body values are converted to ReadableStreams via toReadableStream()
2. The resulting ReadableStream is piped directly to the file using pipeReadableStreamToBlob()
3. This approach works for both regular files and S3 destinations
4. The correct number of bytes written is now returned

This resolves hangs in three scenarios:
- Writing custom JS ReadableStreams wrapped in Response
- Writing Response bodies from fetch() wrapped in new Response
- Writing teed ReadableStreams to files
2025-11-13 01:57:22 +00:00
..