-
Notifications
You must be signed in to change notification settings - Fork 936
Stream SDK file uploads and downloads instead of buffering in memory #1433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
cbf465a
feat(sdk): stream file uploads and downloads instead of buffering in …
mishushakov 9d72b2e
fix(js-sdk): return proper empty values from read() for empty files
mishushakov 6cda03f
fix: address review comments on streaming reads
mishushakov 58c5f86
Merge remote-tracking branch 'origin/main' into mishushakov/stream-wr…
mishushakov 1ae9a34
fix(python-sdk): prevent connection leaks from abandoned stream reads
mishushakov 22d98a3
fix(js-sdk): release stream-read connections on error and GC
mishushakov 9b34ecf
refactor(python-sdk): drop fragile async GC net from AsyncFileStreamR…
mishushakov a869488
Merge remote-tracking branch 'origin/main' into mishushakov/stream-wr…
mishushakov a0d564f
fix(sdks): align streaming connection lifecycle across files and volumes
mishushakov e828699
feat(sdks): default file writes to octet-stream when data is streamable
mishushakov b0b1018
fix(python-sdk): give streamed file uploads the file-transfer timeout
mishushakov d2b7329
refactor(sdks): split volume streaming changes into a follow-up PR
mishushakov 7a52f73
Merge remote-tracking branch 'origin/main' into mishushakov/stream-wr…
mishushakov 21045a2
test(python-sdk): make stream connection-leak assertions race-free
mishushakov eb12c66
fix(js-sdk): cancel underlying body reader when abandoned stream is GC'd
mishushakov ed277d0
refactor(sdks): replace stream GC nets with an idle-read timeout
mishushakov 40a3103
feat(sdks): add per-chunk idle timeout to streamed reads and writes
mishushakov 2022d3a
fix(python-sdk): run streamed-upload reads and gzip off the event loop
mishushakov cc2cd57
refactor(sdks): make the JS read idle timeout bound only the wire
mishushakov d2939b0
docs(python-sdk): scope the FILE_TIMEOUT comment to volume transfers
mishushakov 8c5b640
docs(python-sdk): note envd backstops the streamed-upload per-write t…
mishushakov b8db6b5
test(sdks): drop redundant streamed-read test coverage
mishushakov 4351aae
refactor(python-sdk): drop the now-unused FILE_TIMEOUT constant
mishushakov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| "e2b": patch | ||
| "@e2b/python-sdk": patch | ||
| --- | ||
|
|
||
| Stream uploads instead of buffering streaming input entirely in memory: | ||
|
|
||
| - `Sandbox.files.write()` / `write_files()`: `ReadableStream` data (JS, outside the browser) and file-like objects (Python) are streamed to the sandbox, including when `gzip` is enabled (compression now happens chunk by chunk). `useOctetStream`/`use_octet_stream` now defaults to auto-detect — octet-stream is used when any entry is streamable (so streamed uploads aren't silently buffered) and `multipart/form-data` otherwise; browsers always use `multipart/form-data`. Streamed uploads also use a longer transfer timeout instead of the default request timeout, so large uploads aren't cut off. | ||
| - `Sandbox.files.read(format="stream")`: the request timeout now bounds only the initial handshake instead of killing the stream while it's being consumed (Python disables the read timeout; JS bounds the handshake and supports `signal` to cancel an in-flight stream). A dropped connection during the stream handshake now surfaces the same typed, health-checked error as non-stream reads. | ||
| - Python `Sandbox.files.read(format="stream")`: the response body is now streamed from the sandbox instead of being downloaded into memory before iteration (sync and async). | ||
| - JS `Sandbox.files.read()` with `blob` or `stream` format now returns an empty `Blob`/`ReadableStream` for empty files instead of `""`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.