session_files
Creates, updates, deletes, gets or lists a session_files resource.
Overview
| Name | session_files |
| Type | Resource |
| Id | vercel.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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
read | exec | session_id, path | teamId, slug | 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. |
mkdir | exec | session_id, path | teamId, slug | Creates a new directory in a session's filesystem. By default, parent directories are created recursively if they don't exist (similar to mkdir -p). |
write | exec | session_id | x-cwd, teamId, slug | Uploads 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.
| Name | Datatype | Description |
|---|---|---|
session_id | string | The unique identifier of the session to write files to. |
slug | string | The Team slug to perform the request on behalf of. |
teamId | string | The Team identifier to perform the request on behalf of. |
x-cwd | string | The 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.
- read
- mkdir
- write
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 }}"
}'
;
Creates a new directory in a session's filesystem. By default, parent directories are created recursively if they don't exist (similar to mkdir -p).
EXEC vercel.sandboxes.session_files.mkdir
@session_id='{{ session_id }}' --required,
@teamId='{{ teamId }}',
@slug='{{ slug }}'
@@json=
'{
"cwd": "{{ cwd }}",
"path": "{{ path }}",
"recursive": {{ recursive }}
}'
;
Uploads 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.
EXEC vercel.sandboxes.session_files.write
@session_id='{{ session_id }}' --required,
@x-cwd='{{ x-cwd }}',
@teamId='{{ teamId }}',
@slug='{{ slug }}'
;