HashFile (file hashing)
ts
function HashFile(hashType, fileName: string): string;The HashFile function computes the hash value of a file. The hash value is returned as a string.
This function accepts the following parameters:
| Parameter | Type | Requirement | Explanation |
|---|---|---|---|
hashType | string | required | must be either one of these values: md5, sha1, sha128, sha256, sha384, sha512, sha3128, sha3256, sha3384, sha3512 |
fileName | string | required | fully qualified path to the file of which you want to compute the hash |
Example
ts
{
var h = HashFile('sha256', './documents/resume.pdf');
// if the file exists and the hashType is valid, h will contain the hash value of the file
}