ReadFileAsHex (read file bytes)
ts
function ReadFileAsHex(what: string, offset: number, count: number): string;Reads count bytes from the file specified by what, starting at the given offset. Returns the bytes as a hexadecimal (base16-encoded) string.
| Parameter | Type | Requirement | Explanation |
|---|---|---|---|
what | string | required | Path to a valid, existing file you wish to read |
offset | number | required | The starting byte offset in the file |
count | number | required | The number of bytes to read |
| Return value | Explanation |
|---|---|
| string | The base16-encoded (hexadecimal) bytes read from the file |
Example
ts
var hexData = ReadFileAsHex('/home/user/data.bin', 0, 16);
Log('First 16 bytes (hex): ' + hexData);