Fetch File To Site
site_fetchDownloads a file from a public URL DIRECTLY onto the hosting site, and RESIZES or CONVERTS images on the way in (resize, webp, avif, jpg, quality) — this is the only image processing available for a hosting server, because the container itself has no cwebp, no ImageMagick and no sharp. The CORE fetches the bytes (full internet + memory) and writes them to path under /data/site. Use this for the user's OWN images/logos/PDFs (any domain) or stock photos, INSTEAD of base64-encoding or chunking large files through chat (which wastes memory). Also works around the sandbox's limited outbound DNS (shell curl in site_run_command only reaches whitelisted hosts like images.unsplash.com; site_fetch reaches ANY host). path e.g. 'assets/img/hero.webp'. Binary-safe, up to 20MB per file.
IMAGE PROCESSING happens here, before the file lands: resize accepts '1200x' (width, height follows the aspect ratio), 'x800' (height), '1200x800' (fit inside that box, never cropped or stretched) or '50%'; image_format converts to 'webp', 'jpg', 'png' or 'avif'; quality is 1-100 for the lossy formats (default 82). The hosting container has no cwebp, no ImageMagick and no sharp, so this is how a photo becomes a right-sized WebP — download a 4000px original and write a 1200px WebP in one call. Images are never enlarged past their real size, because upscaling only adds bytes. Not for SVG: an SVG is written through untouched (it is already scalable), and it cannot be rasterised into a PNG favicon here — for that install sharp with site_run_command(background=true).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| path | Yes | ||
| site | No | ||
| resize | No | ||
| server | No | ||
| quality | No | ||
| image_format | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||