|
| 1 | +--- |
| 2 | +title: File |
| 3 | +description: Read, get content, fetch, write, and append files |
| 4 | +--- |
| 5 | + |
| 6 | +import { BlockInfoCard } from "@/components/ui/block-info-card" |
| 7 | + |
| 8 | +<BlockInfoCard |
| 9 | + type="file_v5" |
| 10 | + color="#F5F5F5" |
| 11 | +/> |
| 12 | + |
| 13 | +## Usage Instructions |
| 14 | + |
| 15 | +Read workspace file objects, extract the text content of files, fetch and parse files from URLs with optional headers, write new workspace files, or append content to existing files. |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +## Actions |
| 20 | + |
| 21 | +### `file_read` |
| 22 | + |
| 23 | +#### Input |
| 24 | + |
| 25 | +| Parameter | Type | Required | Description | |
| 26 | +| --------- | ---- | -------- | ----------- | |
| 27 | + |
| 28 | +#### Output |
| 29 | + |
| 30 | +| Parameter | Type | Description | |
| 31 | +| --------- | ---- | ----------- | |
| 32 | +| `files` | file[] | Workspace file objects \(read\) or fetched file objects \(fetch\) | |
| 33 | +| `contents` | array | Array of file text contents, one entry per file \(get content\) | |
| 34 | +| `combinedContent` | string | All fetched file contents merged into a single text string \(fetch\) | |
| 35 | +| `id` | string | File ID \(write and append\) | |
| 36 | +| `name` | string | File name \(write and append\) | |
| 37 | +| `size` | number | File size in bytes \(write and append\) | |
| 38 | +| `url` | string | URL to access the file \(write and append\) | |
| 39 | + |
| 40 | +### `file_get_content` |
| 41 | + |
| 42 | +#### Input |
| 43 | + |
| 44 | +| Parameter | Type | Required | Description | |
| 45 | +| --------- | ---- | -------- | ----------- | |
| 46 | + |
| 47 | +#### Output |
| 48 | + |
| 49 | +| Parameter | Type | Description | |
| 50 | +| --------- | ---- | ----------- | |
| 51 | +| `files` | file[] | Workspace file objects \(read\) or fetched file objects \(fetch\) | |
| 52 | +| `contents` | array | Array of file text contents, one entry per file \(get content\) | |
| 53 | +| `combinedContent` | string | All fetched file contents merged into a single text string \(fetch\) | |
| 54 | +| `id` | string | File ID \(write and append\) | |
| 55 | +| `name` | string | File name \(write and append\) | |
| 56 | +| `size` | number | File size in bytes \(write and append\) | |
| 57 | +| `url` | string | URL to access the file \(write and append\) | |
| 58 | + |
| 59 | +### `file_fetch` |
| 60 | + |
| 61 | +#### Input |
| 62 | + |
| 63 | +| Parameter | Type | Required | Description | |
| 64 | +| --------- | ---- | -------- | ----------- | |
| 65 | + |
| 66 | +#### Output |
| 67 | + |
| 68 | +| Parameter | Type | Description | |
| 69 | +| --------- | ---- | ----------- | |
| 70 | +| `files` | file[] | Workspace file objects \(read\) or fetched file objects \(fetch\) | |
| 71 | +| `contents` | array | Array of file text contents, one entry per file \(get content\) | |
| 72 | +| `combinedContent` | string | All fetched file contents merged into a single text string \(fetch\) | |
| 73 | +| `id` | string | File ID \(write and append\) | |
| 74 | +| `name` | string | File name \(write and append\) | |
| 75 | +| `size` | number | File size in bytes \(write and append\) | |
| 76 | +| `url` | string | URL to access the file \(write and append\) | |
| 77 | + |
| 78 | +### `file_write` |
| 79 | + |
| 80 | +Create a new workspace file. If a file with the same name already exists, a numeric suffix is added (e.g., |
| 81 | + |
| 82 | +#### Input |
| 83 | + |
| 84 | +| Parameter | Type | Required | Description | |
| 85 | +| --------- | ---- | -------- | ----------- | |
| 86 | +| `fileName` | string | Yes | File name \(e.g., "data.csv"\). If a file with this name exists, a numeric suffix is added automatically. | |
| 87 | +| `content` | string | Yes | The text content to write to the file. | |
| 88 | +| `contentType` | string | No | MIME type for new files \(e.g., "text/plain"\). Auto-detected from file extension if omitted. | |
| 89 | + |
| 90 | +#### Output |
| 91 | + |
| 92 | +| Parameter | Type | Description | |
| 93 | +| --------- | ---- | ----------- | |
| 94 | +| `id` | string | File ID | |
| 95 | +| `name` | string | File name | |
| 96 | +| `size` | number | File size in bytes | |
| 97 | +| `url` | string | URL to access the file | |
| 98 | + |
| 99 | +### `file_append` |
| 100 | + |
| 101 | +Append content to an existing workspace file. The file must already exist. Content is added to the end of the file. |
| 102 | + |
| 103 | +#### Input |
| 104 | + |
| 105 | +| Parameter | Type | Required | Description | |
| 106 | +| --------- | ---- | -------- | ----------- | |
| 107 | +| `fileName` | string | Yes | Name of an existing workspace file to append to. | |
| 108 | +| `content` | string | Yes | The text content to append to the file. | |
| 109 | + |
| 110 | +#### Output |
| 111 | + |
| 112 | +| Parameter | Type | Description | |
| 113 | +| --------- | ---- | ----------- | |
| 114 | +| `id` | string | File ID | |
| 115 | +| `name` | string | File name | |
| 116 | +| `size` | number | File size in bytes | |
| 117 | +| `url` | string | URL to access the file | |
| 118 | + |
| 119 | + |
0 commit comments