@xtsai/xai-utils
Version:
The xai-utils is an openai nodejs sdk compatible extension library.
18 lines • 474 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.calcHash = calcHash;
const crypto_1 = require("crypto");
/**
*
* @param content
* @param opts
* @returns hash string
*/
function calcHash(content = '', opts = {
encoding: 'utf8',
alg: 'sha256',
}) {
const { encoding = 'utf8', alg = 'sha256' } = opts;
return (0, crypto_1.createHash)(alg).update(content, encoding).digest('hex');
}
//# sourceMappingURL=file.hash.js.map