ReadTextFile (read a text file)
ts
function ReadTextFile(what: string): string;
This function reads the what
text file and returns its entire contents as a string. If the file doesn’t exist or if the operating system returns an I/O error, this function returns an empty string
.
This function accepts the following parameters:
Parameter | Type | Requirement | Explanation |
---|---|---|---|
what | string | required | must be a valid and existing path to a file you wish to read |
Return value:
Type | Explanation |
---|---|
string | the entire contents of the file as a single string (may contain weird/unpredictable characters if you attempt to read a binary file) |