代码如下:
let filePath = pathDir + "/test.txt";
hash.hash(filePath, "sha256").then((str: string) => {
console.info("calculate file hash succeed:" + str);
}).catch((err: BusinessError) => {
console.error("calculate file hash failed with error message: " + err.message + ", error code: " + err.code);
});
sha512 hash的摘要代码demo实例 如下