Get panel file
panel_file_get · Tools · Workspace
Read one file of a panel version
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
file | string | Yes | The file's name in the version, such as `app.js` or `index.html`. |
limit | integer | No | The most characters of text to return. |
offset | integer | No | How many characters of the file's text to skip: 0, or the next_offset of the previous answer. |
panel | string | Yes | The panel's id. |
version | string | No | The id of the version to read from. Left out, the version people see. |
Panel File Get Tool#
panel_file_get reads the text of one file of a panel version: its main HTML, a script, a stylesheet or an SVG image, or a vendor library the version lists.
When to Use#
The agent uses it before patching an asset other than the main HTML with panel_update, so the lines a patch copies are the asset's current lines.
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
panel |
string | Yes | The panel's id |
file |
string | Yes | The asset's name in the version, as panel_get lists it in files, such as app.js; or a vendor identifier the version lists, such as verdalia-ui.js |
version |
string | No | The id of the version to read from. Left out, the version people see |
offset |
integer | No | How many characters of the file's text to skip: 0 (the default), or next_offset of the previous answer |
limit |
integer | No | The most characters of text to return, from 1 to 20,000. Left out, 20,000 |
Returns#
| Field | Type | Description |
|---|---|---|
version |
string | The id of the version read |
asset |
string or null | The asset's id; null for a vendor library, whose text comes with Verdalia |
name |
string | The file's name |
kind |
string | html, js, css or svg |
hash |
string | The SHA-256 of its text |
bytes |
integer | Its size |
content |
string | The file's text from offset: at most limit characters |
total_chars |
integer | The length of the file's whole text in characters |
next_offset |
integer or null | The offset of the text after content; null when content reaches the end |
Example Scenario#
{ "panel": "01JC4Z8Q2V6M3K9T1R5X7B0N4D", "file": "app.js" }
Notes#
- One call answers at most 20,000 characters, whoever calls. A longer file is read in parts by calling again with
offsetset tonext_offsetuntil it isnull - A
limitbelow1or above20,000is refused; anoffsetat or past the end answers emptycontent - A name the version does not hold is refused:
Version <id> has no file named <name>; a vendor library the version does not list is refused the same way - A version id the panel does not have is refused:
The panel has no version with the id <id> - A panel the workspace does not have is refused:
No panel has the id <id> - Risk: read