# How do I upload a large file to my computer from my own code? With program 0.1.18 on the computer and a current Python or Node package, one call sends a local file of up to 256 MiB to a computer you connected: uploadFile in TypeScript (Node) or upload\_file in Python. It uploads in chunks, can continue after a lost reply, checks the whole-file SHA-256 at the end and never overwrites an existing file. Facts read: 2026-11-30 ## What you get [Section on website](https://cmdop.ai/academy/lessons/upload-file-to-your-computer-from-code#what-you-get-title) A file on the machine where your program runs lands on one of your connected computers, byte for byte: the computer checks the whole-file hash before it creates the file. Your program sends binary data in chunks; nothing goes through one huge call or base64 pasted into a prompt. ## What you need [Section on website](https://cmdop.ai/academy/lessons/upload-file-to-your-computer-from-code#need-title) - Program 0.1.18 or later on the computer that receives the file. - A current Python or Node package. The docs page below states the minimum version that has the upload helper. - An agent token with `write` switched on, by you. A new agent can only read. - `CMDOP_URL` and `CMDOP_TOKEN` set in your program's environment, as in the first program from code. - [Files and screenshots from the packages](https://docs.cmdop.ai/reference/sdk/files-and-screen) - [Choose what an agent may do](https://docs.cmdop.ai/guides/access) - [Your computers from Python or Node](https://cmdop.ai/academy/lessons/run-commands-from-python-or-node.md) ## The code [Section on website](https://cmdop.ai/academy/lessons/upload-file-to-your-computer-from-code#code-title) The example reads `./export.zip` on the computer running your program. Replace `` with your computer's name and `//export.zip` with a path that does not exist yet. It saves a fresh transfer id to `upload-id.txt` before the first call, so you can recover after a disconnect. Python ```text import os import secrets import cmdop transfer = secrets.token_hex(16) with open("./upload-id.txt", "x", encoding="utf-8") as checkpoint: checkpoint.write(transfer + "\n") checkpoint.flush() os.fsync(checkpoint.fileno()) with cmdop.connect() as client: result = cmdop.upload_file( client.machine(""), "./export.zip", "//export.zip", transfer=transfer, ) if result.receipt is None: raise RuntimeError("No committed file receipt.") print("committed") ``` In Node, `uploadFile` takes the same three arguments and `{ transfer }`; the TypeScript version of this example is on the docs page. - [Files and screenshots from the packages](https://docs.cmdop.ai/reference/sdk/files-and-screen) It prints `committed` only after the computer returns a verified receipt: the destination path, its size, its SHA-256 and that it was created. Python also has `upload_file_async`, and the helpers in both languages accept a progress callback. ## How it works [Section on website](https://cmdop.ai/academy/lessons/upload-file-to-your-computer-from-code#how-title) The helper begins an upload with an id, the size and the SHA-256, sends chunks of at most 1 MiB, then commits. If a reply is lost, `fs_upload_status` returns the offset the computer confirmed and the helper continues from there. At commit the computer checks the size and the whole-file hash, then creates the destination. If a file already exists there, the upload is refused. An upload expires 15 minutes after it begins. - [fs\_upload\_begin and the other upload tools](https://docs.cmdop.ai/reference/tools/fs_upload_begin) - [Larger files](https://docs.cmdop.ai/guides/files#larger-files) ## Check what it did [Section on website](https://cmdop.ai/academy/lessons/upload-file-to-your-computer-from-code#check-title) Each upload call is recorded under the agent's name on the computer's own record, with the time. Give each program its own token, so the record says which one wrote the file. - [The record of calls](https://docs.cmdop.ai/concepts/audit-and-history) ## Limits [Section on website](https://cmdop.ai/academy/lessons/upload-file-to-your-computer-from-code#limits-title) - Up to 256 MiB per file. Each computer runs at most 4 uploads at a time and reserves at most 512 MiB for them. - The file comes from a path your program can read. It is not a browser upload, and a file inside a ChatGPT conversation is not a local path. - Create-only: an existing destination is refused, never replaced. - Without `write` switched on for that agent, the call is refused and no file is created. - macOS and Linux computers; on macOS it is supported by the shipped machine. Windows is not supported yet. - [Changelog: 0.1.18](https://docs.cmdop.ai/help/changelog#0118) - [Feature status](https://docs.cmdop.ai/help/feature-status) ## Related materials - [Your computers from Python or Node](https://cmdop.ai/academy/lessons/run-commands-from-python-or-node.md) - [Ask ChatGPT to open an app on your Mac](https://cmdop.ai/academy/lessons/chatgpt-open-app-on-mac.md) - [A home Linux server for Claude Code or Codex, no SSH key](https://cmdop.ai/academy/lessons/home-linux-server-without-ssh-key.md) [All materials in this path](https://cmdop.ai/academy.md)