René's URL Explorer Experiment


Title: fix(files): stream served files with byte ranges instead of buffering them under 100 MB by waleedlatif1 · Pull Request #9542 · simstudioai/sim · GitHub

Open Graph Title: fix(files): stream served files with byte ranges instead of buffering them under 100 MB by waleedlatif1 · Pull Request #9542 · simstudioai/sim

X Title: fix(files): stream served files with byte ranges instead of buffering them under 100 MB by waleedlatif1 · Pull Request #9542 · simstudioai/sim

Description: Summary /api/files/serve read every file fully into memory and refused anything over 100 MB (413), while workspace files are admitted up to 5 GB, so large files (e.g. agent-rendered videos) could never be downloaded or previewed Every request answered with the stored object byte-for-byte (raw, or not a Sim page / generated document / preview=1, which may be a HEIC transcode) now streams from storage instead; transformed representations stay buffered and bounded exactly as before HTTP Range support end to end: resolveByteRange (single range, suffix, clamp, 416, If-Range strong-ETag only), ranged downloadFileStream for S3 / Blob / GCS / local, and createStoredFileStreamResponse (200 / 206 / 304 / 416 with Accept-Ranges, Content-Range, a strong ETag). Seeking works, and Safari can play at all Workspace files keep the open-then-recheck delivery guarantee through a shared streamAuthorizedWorkspaceFile helper (access + read receipt + provenance rechecked after storage opens, stream disposed on refusal); the inline-image use case now uses the same helper instead of its own copy Legacy contexts (execution outputs, chat/copilot attachments, knowledge docs) stream the same way, sized and versioned by a storage HEAD Removed the buffered readWorkspaceFileContentByKey use case (raw reads now stream) and renamed its module to read-workspace-file-record-by-key Client: downloads over 100 MB are HEAD-probed then handed to the browser's download manager instead of being read into a tab Blob; smaller downloads are unchanged Client: audio/video previews play straight from the serve URL (progressive playback + seeking) on sources that declare servesByteRanges; project and public-share sources keep the blob path. A failed load is diagnosed with a HEAD probe (replaced key → record re-resolved; unplayable format → "can't be played" message), and a load that finishes before hydration is picked up on mount so the spinner never sticks Type of Change Bug fix Testing New lib/uploads/server/byte-range.test.ts (29 cases, written failure-modes-first), stream-authorized-workspace-file.test.ts, streaming cases in app/api/files/serve/[...path]/route.test.ts (200/206/416/304/If-Range, legacy streaming, buffered paths unchanged), large-download cases in lib/uploads/client/download.test.ts; each guard red-checked by reverting it Ran the touched suites plus storage-service, provider client, inline/download use case and files-utils tests locally (all green); check:api-validation:strict, check:comment-hygiene, check:source-conventions, check:client-boundary, check:test-patterns, check:file-names, check:utils, check:boundaries, block registry check, lint Local E2E against next dev with local storage and a real session: 14/14 HTTP checks on a 151 MB non-faststart MP4 (byte-exact full download by SHA-256, exact 206 slices incl. suffix/tail, 416, 304, stale/matching If-Range, HEAD, immutable v=, unauthenticated 401); WebKit + Chromium: preview plays, seeks to near the end, Download button saves the exact file; a 5 MB clip behaves the same; server RSS flat while a 1 MB/s client streamed the whole file Full bun run test, check:audits and type-check left to CI Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing (new tests pass the test-audit authoring gate) No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA) 🤖 Generated with Claude Code

Open Graph Description: Summary /api/files/serve read every file fully into memory and refused anything over 100 MB (413), while workspace files are admitted up to 5 GB, so large files (e.g. agent-rendered videos) could ...

X Description: Summary /api/files/serve read every file fully into memory and refused anything over 100 MB (413), while workspace files are admitted up to 5 GB, so large files (e.g. agent-rendered videos) could ...

Opengraph URL: https://github.com/simstudioai/sim/pull/9542

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:60a6334e-5ea6-442d-3d79-106e73dce6fc
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8C36:2F3C5F:A9542:F39CC:6AFB1C42
html-safe-nonce420dbb7c4988b108688da813661adb29d2c28741058c9c7e252aec14897a8664
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QzM2OjJGM0M1RjpBOTU0MjpGMzlDQzo2QUZCMUM0MiIsInZpc2l0b3JfaWQiOiI2MDAyNzk3MTA3MTM5Nzc5MjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaca7f3572cd2c4d0c17c1c2b90fde8923067cac951c71680c23af475f93e42e074
hovercard-subject-tagpull_request:5102401008
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/9542/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altSummary /api/files/serve read every file fully into memory and refused anything over 100 MB (413), while workspace files are admitted up to 5 GB, so large files (e.g. agent-rendered videos) could ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None24933791aba0f10b2f189f8b953a1452dd79933933ac13a0a67b8ad3acee3d9f
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release030711cc180b563614a434f4376acf7da5d445fa
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/9542/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F9542%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F9542%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/9542/files
Reloadhttps://github.com/simstudioai/sim/pull/9542/files
Reloadhttps://github.com/simstudioai/sim/pull/9542/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests198 (198)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
fix/file-serve-streaminghttps://github.com/simstudioai/sim/tree/fix/file-serve-streaming
Conversation 30 https://github.com/simstudioai/sim/pull/9542
Commits 3 https://github.com/simstudioai/sim/pull/9542/commits
Checks 68 https://github.com/simstudioai/sim/pull/9542/checks
Files changed https://github.com/simstudioai/sim/pull/9542/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9542/files
fix(files): stream served files with byte ranges instead of buffering them under 100 MB https://github.com/simstudioai/sim/pull/9542/files#top
Show all changes 3 commits https://github.com/simstudioai/sim/pull/9542/files
9873df0 fix(files): stream served files with byte ranges instead of buffering… waleedlatif1 Oct 31, 2026 https://github.com/simstudioai/sim/pull/9542/commits/9873df03881b5455a0dcb39e596525d9ea45ef85
fc1e8ea fix(files): stream finished document uploads, diagnose playback error… waleedlatif1 Oct 31, 2026 https://github.com/simstudioai/sim/pull/9542/commits/fc1e8ea5daa64400d6de43c0744caa556d7635eb
75dacb4 fix(files): probe served bytes before handing off, keep generated doc… waleedlatif1 Oct 31, 2026 https://github.com/simstudioai/sim/pull/9542/commits/75dacb4fefe590d6aa6b52fbba0bb37c2e2a146f
Clear filters https://github.com/simstudioai/sim/pull/9542/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9542/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9542/files
route.test.ts https://github.com/simstudioai/sim/pull/9542/files#diff-aaa040f5cf2c4f4a89280a9560728fcb6c688e410ee0f6945faee6a913a8634f
route.ts https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
utils.ts https://github.com/simstudioai/sim/pull/9542/files#diff-cf0dbd7a02f4ac25fd4c864b014708c1d978d75efe972fae5ffcb021be58a9d3
file-viewer.tsx https://github.com/simstudioai/sim/pull/9542/files#diff-41f31a97adfda85382418ff71f00df02005b2d85b01516c49967857a1ee0b948
memory-harness.integration.ts https://github.com/simstudioai/sim/pull/9542/files#diff-4fc60dda6412e66b9374ad5d3e0e91e9ac365f0de7e77198e28636341697ef07
workspace-files.ts https://github.com/simstudioai/sim/pull/9542/files#diff-29d9b6d312177176db7c67d2754eb013b3ee7dc842dbbdb481bed86f551d4f37
use-file-content-source.tsx https://github.com/simstudioai/sim/pull/9542/files#diff-90976156a39bdd21612371dd8e08cf7a466bbf188c03cc869cf3aaf9cf1ad73a
download.test.ts https://github.com/simstudioai/sim/pull/9542/files#diff-159abfd488d5e6007b5fe158c035443cc3e6fa33f76ce499bca3ec135ba380c2
download.ts https://github.com/simstudioai/sim/pull/9542/files#diff-792c5cfd9d600277ea52e08970dfec8b42adb5439e7ee10c47b19e01f741aa70
storage-service.ts https://github.com/simstudioai/sim/pull/9542/files#diff-8768f26f6a6d271a9bf26da5650f60add71370858edf7f9fd68abbfe423030fd
client.ts https://github.com/simstudioai/sim/pull/9542/files#diff-18c5e5601b785187c2869df9487f62855e73ffe29d37ec600f94f3163c2d5bce
client.ts https://github.com/simstudioai/sim/pull/9542/files#diff-7afd9385c1ecdc50bf272485daac563680d8a3c9b2275a04befea14e21c86523
client.ts https://github.com/simstudioai/sim/pull/9542/files#diff-5b5c75fd8b0e84e44544dfe3eb319a86603568755f5568c5b4ce3007b519927e
byte-range.test.ts https://github.com/simstudioai/sim/pull/9542/files#diff-82ebd376dee4985bf875d61ed31ec5e171620853f58c00e1a7e659433259cec2
byte-range.ts https://github.com/simstudioai/sim/pull/9542/files#diff-f5f73f06e498f5e13f8b2d23c53731d7344fa026b63d462121ebde041a4fc8ad
delivery.ts https://github.com/simstudioai/sim/pull/9542/files#diff-1a70f50558db85a00d2709cdfa887369fd7fa6100efd797eb77b93395e72a65b
types.ts https://github.com/simstudioai/sim/pull/9542/files#diff-9fe4883673f33f33785c7e6e3f5757e9329f88d2d6207a9dc82289b5acd3492b
provider.ts https://github.com/simstudioai/sim/pull/9542/files#diff-17f676c7236206f73f675e44061995fc88665b2fc6102ba906900ad1b147d3fa
read-workspace-file-record-by-key.test.ts https://github.com/simstudioai/sim/pull/9542/files#diff-ec4849619f451af06efbb72da2376b72e1eb336599df9299deff8838fe0d5f4a
read-workspace-file-record-by-key.ts https://github.com/simstudioai/sim/pull/9542/files#diff-5d8f615b99c67714cea4a40b8aa1c0de5f7a66be4e559a56e68d083c41db375f
read-workspace-inline-file.ts https://github.com/simstudioai/sim/pull/9542/files#diff-fd123fbfda6f10d48bf02de76d91d1d98421d391a938156ab5d5f67f52bb3497
stream-authorized-workspace-file.test.ts https://github.com/simstudioai/sim/pull/9542/files#diff-ff9bd8417a13cd9d7161f32131a68446c450407f17b45b0fb981e52c0e681765
stream-authorized-workspace-file.ts https://github.com/simstudioai/sim/pull/9542/files#diff-115eb32813da42bb7cb6630c45e93d35a6f89fb16bdf9cffda8f83a1e46a00f8
check-unused-exports.baseline.json https://github.com/simstudioai/sim/pull/9542/files#diff-4b59a8526a4f226dffb0fbf6b8ec25d3082ab45da697f584eaaca4bd483c928f
apps/sim/app/api/files/serve/[...path]/route.test.tshttps://github.com/simstudioai/sim/pull/9542/files#diff-aaa040f5cf2c4f4a89280a9560728fcb6c688e410ee0f6945faee6a913a8634f
View file https://github.com/simstudioai/sim/blob/75dacb4fefe590d6aa6b52fbba0bb37c2e2a146f/apps/sim/app/api/files/serve/%5B...path%5D/route.test.ts
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/simstudioai/sim/pull/9542/files
apps/sim/app/api/files/serve/[...path]/route.tshttps://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
View file https://github.com/simstudioai/sim/blob/75dacb4fefe590d6aa6b52fbba0bb37c2e2a146f/apps/sim/app/api/files/serve/%5B...path%5D/route.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9542/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
Please reload this pagehttps://github.com/simstudioai/sim/pull/9542/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9542/files
https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/9542/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
Please reload this pagehttps://github.com/simstudioai/sim/pull/9542/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9542/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.