File Functions
Functions for working with files over HTTP.
| Function | Description | Input → Output |
|---|---|---|
| Download | Fetch a text resource over HTTP/HTTPS | url, headers → file, contentType, statusCode |
Download
Fetch a remote resource and return its body as text. The block is intended for text payloads — JSON, plain text, webhook content, XML.
| Input | Required | Description |
|---|---|---|
| url | yes | Full http:// or https:// URL |
| headers | no | JSON object of request headers |
| Output | Type | Description |
|---|---|---|
| file | string | Response body decoded as UTF-8 |
| contentType | string | Content-Type header from the server |
| statusCode | number | HTTP status code |
Safety limits
To keep one flow from taking down the worker, the action enforces hard caps:
| Limit | Value | What happens when exceeded |
|---|---|---|
| Response size | 10 MiB | Block fails with Response too large … |
| Total time | 30 seconds | Block fails with Download timed out after 30000 ms |
| Target host | private/reserved IPs blocked | Block fails with … not allowed |
The size cap applies in two ways:
- If the server sends a
Content-Lengthheader bigger than 10 MiB, the request is rejected immediately (no body is read). - Otherwise the body is read progressively; the read is cancelled as soon as the running total crosses the cap.
The host filter rejects any URL whose hostname resolves to a private, link-local, loopback, CGNAT/Tailscale, or cloud-metadata address. This prevents flows from probing internal infrastructure (SSRF).
Limitations
- Text only. Binary files (images, PDFs, archives) come back as garbled UTF-8 and should not be used. A binary-safe upload action is on the roadmap (
Upload, currently stubbed). - No retry. A transient 5xx or a timeout returns ERROR; chain the block with Branch and Retry After if your flow needs retries.
Example
Fetch a JSON webhook payload:
| Input | Value |
|---|---|
| url | https://api.example.com/webhook/abc123 |
| headers | { "Authorization": "Bearer …" } |
Outputs:
file→{"event":"...","data":{...}}contentType→application/jsonstatusCode→200
Use JSON → Parse on file to extract fields.