Skip to main content

session_files

Creates, updates, deletes, gets or lists a session_files resource.

Overview​

Namesession_files
TypeResource
Idvercel.sandboxes.session_files

Fields​

The following fields are returned by SELECT queries:

SELECT not supported for this resource, use SHOW METHODS to view available operations for the resource.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
readexecsession_id, pathteamId, slugDownloads the contents of a file from a session's filesystem. The file content is returned as a binary stream with appropriate Content-Disposition headers for file download.
mkdirexecsession_id, pathteamId, slugCreates a new directory in a session's filesystem. By default, parent directories are created recursively if they don't exist (similar to mkdir -p).
writeexecsession_idx-cwd, teamId, slugUploads and extracts files to a session's filesystem. Files must be uploaded as a gzipped tarball (.tar.gz) with the Content-Type header set to application/gzip. The tarball contents are extracted to the session's working directory, or to a custom directory specified via the x-cwd header.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
session_idstringThe unique identifier of the session to write files to.
slugstringThe Team slug to perform the request on behalf of.
teamIdstringThe Team identifier to perform the request on behalf of.
x-cwdstringThe target directory where the tarball contents will be extracted. If not specified, files are extracted to the sandbox home directory.

Lifecycle Methods​

EXEC variables use wire (API) names.

Downloads the contents of a file from a session's filesystem. The file content is returned as a binary stream with appropriate Content-Disposition headers for file download.

EXEC vercel.sandboxes.session_files.read
@session_id='{{ session_id }}' --required,
@teamId='{{ teamId }}',
@slug='{{ slug }}'
@@json=
'{
"cwd": "{{ cwd }}",
"path": "{{ path }}"
}'
;