diff --git a/docs/filesystem/upload.mdx b/docs/filesystem/upload.mdx index 63e0b00a..e4302c3f 100644 --- a/docs/filesystem/upload.mdx +++ b/docs/filesystem/upload.mdx @@ -7,6 +7,8 @@ You can upload data to the sandbox using the `files.write()` method. ## Upload single file +Read the file from your local filesystem and pass its contents to `files.write()`. + ```js JavaScript & TypeScript import fs from 'fs' @@ -31,6 +33,19 @@ with open("path/to/local/file", "rb") as file: ``` +The upload has a default request timeout of 60 seconds. If you're uploading large files that take longer to transfer, override it by passing `requestTimeoutMs` (JavaScript & TypeScript) or `request_timeout` (Python). + + +```js JavaScript & TypeScript +// Override the default 60 second request timeout with 120 seconds +await sandbox.files.write('/path/in/sandbox', content, { requestTimeoutMs: 120_000 }) +``` +```python Python +# Override the default 60 second request timeout with 120 seconds +sandbox.files.write("/path/in/sandbox", file, request_timeout=120) +``` + + ## Upload with pre-signed URL Sometimes, you may want to let users from unauthorized environments, like a browser, upload files to the sandbox.