t-comm
Version:
专业、稳定、纯粹的工具库
14 lines (13 loc) • 415 B
TypeScript
/// <reference types="node" />
import type * as CryptoType from 'crypto';
/**
* 获取 Node.js 的 crypto 模块
* 这样可以避免在浏览器环境中直接导入 crypto 模块导致的错误
* @returns crypto 模块
* @example
* ```ts
* const crypto = getCrypto();
* const hash = crypto.createHash('md5').update('hello').digest('hex');
* ```
*/
export declare function getCrypto(): typeof CryptoType;