Skip to main content
Examples use the api client from Creating the client. appId is the id of one of your apps: api.account.me() lists them.

Accepted inputs

apps.create() and apps.commit() take: On edge runtimes and in the browser, pass a Blob, File or Uint8Array: a path only works where node:fs exists. Uploads are limited to 100 MB. A larger file fails locally with FILE_TOO_LARGE (status 0) before anything is sent. Uploads are streamed and have no timeout: pass a signal to cancel one.

Creating an application

apps.create(file) deploys a .zip that contains a squarecloud.app configuration file at its root.

Committing to an application

apps.commit(appId, file, { path, filename, signal }) uploads a file into an existing app:
  • A .zip is unpacked at path (the app root by default).
  • Any other file lands at path/<filename>.
The filename is filename, else the file’s own name (path or File), else commit.zip.
A commit does not restart the app. Call apps.restart() to apply it.

Cancelling an upload

An aborted upload rejects with the signal’s reason.

Errors

A local path that cannot be opened throws the file system error, not a SquareCloudAPIError. See Errors for the full list.

Next steps

Managing files

List, read, write, move and delete app files.

Upload API reference

The REST endpoints behind these methods.

Upload from the CLI

The same actions from the terminal.