Skip to content

fix: support Blob file input for Bun compatibility#161

Open
bobbyg603 wants to merge 1 commit intomainfrom
fix/blob-upload-support
Open

fix: support Blob file input for Bun compatibility#161
bobbyg603 wants to merge 1 commit intomainfrom
fix/blob-upload-support

Conversation

@bobbyg603
Copy link
Copy Markdown
Member

Summary

  • Adds Blob support to GZippedSymbolFile.file and UploadableFile.file types
  • When file.file is a Blob, postSymbols validates gzip magic bytes via slice(0, 2) instead of tee(), and passes the Blob directly to S3 upload
  • Existing ReadableStream path is unchanged

Why

Bun's fetch cannot properly PUT a ReadableStream body to S3 presigned URLs — it sends chunked transfer encoding instead of honoring content-length, which S3 rejects. However, Bun.file() returns a lazy Blob that streams from disk, and Bun's fetch handles Blob bodies natively with proper content-length. This enables @bugsplat/symbol-upload to work with Bun-compiled executables.

Test plan

  • All 234 existing tests pass
  • 3 new tests for Blob path (accept Blob, upload without tee, reject non-gzip Blob)
  • Build passes (both CJS and ESM)

🤖 Generated with Claude Code

Bun's fetch cannot properly PUT a ReadableStream to S3 presigned URLs
(it uses chunked transfer encoding instead of content-length). However,
Bun.file() returns a lazy Blob that streams from disk and Bun's fetch
handles it natively with proper content-length.

This adds an instanceof Blob check in postSymbols: for Blob inputs, gzip
magic bytes are validated via slice() instead of tee(), and the Blob is
passed directly to fetch without stream manipulation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant