|
1 | 1 | # System Tools |
| 2 | + |
2 | 3 | GPTScript comes with a set of system tools that provide various core functionalities. |
3 | 4 |
|
4 | 5 | ## sys.abort |
| 6 | + |
5 | 7 | Aborts the operation and provides an error message. |
| 8 | + |
6 | 9 | #### Arguments |
| 10 | + |
7 | 11 | - `message`: The description of the error or unexpected result that caused abort to be called. |
8 | 12 |
|
9 | 13 | ## sys.download |
| 14 | + |
10 | 15 | Downloads a file from a specified URL to an optional location on disk with an option to override existing files. |
| 16 | + |
11 | 17 | #### Arguments |
| 18 | + |
12 | 19 | - `location` (optional): The on-disk location to store the downloaded file. |
13 | 20 | - `override`: If true, allows overwriting of an existing file. Default is false. |
14 | 21 | - `url`: The HTTP or HTTPS URL of the file to be downloaded. |
15 | 22 |
|
16 | 23 | ## sys.exec |
| 24 | + |
17 | 25 | Executes a command with the ability to specify command arguments and the working directory. |
| 26 | + |
18 | 27 | #### Arguments |
| 28 | + |
19 | 29 | - `command`: The full command to run, including all arguments. |
20 | 30 | - `directory`: The working directory for the command. Defaults to the current directory ".". |
21 | 31 |
|
22 | 32 | ## sys.find |
| 33 | + |
23 | 34 | Searches for files within a directory that match a given pattern using Unix glob format. |
| 35 | + |
24 | 36 | #### Arguments |
| 37 | + |
25 | 38 | - `directory`: The directory to perform the search in. Defaults to the current directory ".". |
26 | 39 | - `pattern`: The pattern to match against filenames. |
27 | 40 |
|
28 | 41 | ## sys.getenv |
| 42 | + |
29 | 43 | Retrieves the value of an environment variable. |
| 44 | + |
30 | 45 | #### Arguments |
| 46 | + |
31 | 47 | - `name`: The name of the environment variable to retrieve. |
32 | 48 |
|
33 | 49 | ## sys.http.get |
| 50 | + |
34 | 51 | Performs an HTTP GET request to the specified URL. |
| 52 | + |
35 | 53 | #### Arguments |
| 54 | + |
36 | 55 | - `url`: The URL to perform the GET request. |
37 | 56 |
|
38 | 57 | ## sys.http.html2text |
| 58 | + |
39 | 59 | Converts the HTML content from a given URL to plain text. |
| 60 | + |
40 | 61 | #### Arguments |
| 62 | + |
41 | 63 | - `url`: The URL of the HTML content to be converted. |
42 | 64 |
|
43 | 65 | ## sys.http.post |
| 66 | + |
44 | 67 | Sends an HTTP POST request with given content to a specified URL. |
| 68 | + |
45 | 69 | #### Arguments |
| 70 | + |
46 | 71 | - `content`: The content to be posted. |
47 | 72 | - `contentType`: The MIME type of the content being posted. |
48 | 73 | - `url`: The URL to which the POST request should be sent. |
49 | 74 |
|
50 | 75 | ## sys.read |
| 76 | + |
51 | 77 | Reads the content from a specified file. |
| 78 | + |
52 | 79 | #### Arguments |
| 80 | + |
53 | 81 | - `filename`: The name of the file from which to read content. |
54 | 82 |
|
55 | 83 | ## sys.remove |
| 84 | + |
56 | 85 | Removes a file from the specified location. |
| 86 | + |
57 | 87 | #### Arguments |
| 88 | + |
58 | 89 | - `location`: The path to the file that needs to be removed. |
59 | 90 |
|
| 91 | +## sys.stat |
| 92 | + |
| 93 | +Retrieves the status of a file, such as size, permissions, and last modified time. |
| 94 | + |
| 95 | +#### Arguments |
| 96 | + |
| 97 | +- `filepath`: The path to the file for which to retrieve status. |
| 98 | + |
60 | 99 | ## sys.write |
| 100 | + |
61 | 101 | Writes content to a specified file. |
| 102 | + |
62 | 103 | #### Arguments |
| 104 | + |
63 | 105 | - `content`: The content to be written to the file. |
64 | 106 | - `filename`: The filename where the content should be written. |
0 commit comments