sandbox_get
Gets a file or directory under /work, /tmp or /dev/shm as a download URL valid for an hour (a directory as a tar.gz); small images also come back inline.
| Input | Output |
|---|---|
id, path or paths |
url (valid 1 hour: https://api.parallelsandbox.com/v1/files/…, which redirects to storage when opened), name, bytes, contentType, archive, expiresAt; for a directory, a note, and changedWhileReading when files were still being written; a single small image also inline; with paths, files[] of these, each with its path, and only path and error for one that cannot be fetched, then the first 10 images (8 MB in all), each after a line with its path, and a note when more were left as URLs only |
To save files on your own machine through the stdio adapter, use sandbox_pull instead: it downloads them and unpacks a directory into a local folder. A directory fetched with sandbox_get says so in its note.
sandbox_get uploads a temporary copy of a file or directory; directories become tar.gz archives, with the directory itself as the top entry. A path is relative to /work (shots is /work/shots; /work/shots works too), or an absolute path under /tmp/ or /dev/shm/, where tests often write their output; any other absolute path is refused. The download URL is valid for one hour; expiresAt says until when, and is earlier when the credentials that signed it expire first. If a download is refused (HTTP 403), call sandbox_get again for a fresh URL. The temporary copy is automatically deleted after about one day and does not count toward stored-file usage. You can request a new URL while the box exists. Download files you need to keep before stopping the box, for example with sandbox_pull. Once stopped, no new URL can be requested; an existing URL works only until it expires. Use paths for up to 50 files in one call; files with the same name receive separate URLs and keep their own contents. A single PNG, JPEG, WebP or GIF of up to 4 MB is also included inline; with paths, so are the first 10 images, up to 8 MB in all, each labelled with its path, and the rest come as URLs only, with a note saying how many. On an interrupted box whose /work was saved before its machine went away, path: "/work" returns that copy as work.tar.gz (Box states).
Every tool and topic is listed in the tool reference.