Skip to navigation

Read a file, or a directory as tar

Without archive, returns the bytes of the file at path. With archive=tar, returns the directory at path as an uncompressed tar stream. Entries are relative to path and can start with ./. A directory read without archive=tar returns 400.

The content type is application/octet-stream in both cases. A tar response has no content-length.

A sandbox runs code you may not trust. When you unpack a downloaded tar, refuse symlinks, hard links, and paths that leave the target directory.

Scope: sandboxes.

curl -sS "$MEADOW_BASE_URL/v1/sandboxes/$SANDBOX_ID/files?path=/tmp/project&archive=tar" \
-H "Authorization: Bearer $MEADOW_API_KEY" | tar -xf - -C ./out

Authentication

AuthorizationBearer

A Meadow API key, sent as Authorization: Bearer mdw_.... The header x-api-key: mdw_... is accepted in its place.

Path parameters

sandbox_idstringRequired

The sandbox id returned by POST /v1/sandboxes. It must belong to the key’s project.

Query parameters

pathstringRequired

Absolute path inside the sandbox, at most 4096 bytes, with no .. segment. For a single file it must not end with /.

archiveenumOptional

Set to tar to send or receive a directory as an uncompressed tar stream. Entries are relative to path, with no top-level folder. Any other value returns 400.

Allowed values:

Response headers

x-request-idstringOptional

Meadow’s id for this request, req_ and 24 hex characters. Every response carries it, including errors, streams and unknown routes. Every error in the Error schema repeats it as request_id. Quote it when you report a problem.

Response

The file's bytes, or a tar stream.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
429
Too Many Requests Error
500
Internal Server Error
502
Bad Gateway Error