Skip to content

Commit 822e831

Browse files
committed
docs: clarify file upload supports file handles without reading into memory
1 parent c6f1222 commit 822e831

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

UPGRADING.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,14 @@ url = file.urls["get"]
476476
### After (v2)
477477

478478
```python
479-
# Upload file (takes bytes, not file handle)
479+
# Upload file (supports file handle, bytes, or PathLike)
480+
with open("image.jpg", "rb") as f:
481+
file = replicate.files.create(
482+
content=f, # Can pass file handle directly
483+
filename="image.jpg"
484+
)
485+
486+
# Or read into memory if needed
480487
with open("image.jpg", "rb") as f:
481488
file = replicate.files.create(
482489
content=f.read(),

0 commit comments

Comments
 (0)