import Crypto from 'crypto'; import Stream from 'stream'; import Fs from 'fs'; export declare const createHash: (str: Crypto.BinaryLike, type?: string, target?: Crypto.BinaryToTextEncoding) => any; export declare const createHmac: (str: Crypto.BinaryLike, key: Crypto.BinaryLike, type?: string, target?: Crypto.BinaryToTextEncoding) => any; /** * 计算文件的哈希值 * @param path 文件路径或文件可读流 */ export declare const createFileHash: (path: string | Stream.Readable, type?: string, target?: Crypto.BinaryToTextEncoding) => Promise; export declare const getTimestamp: (datetime?: string) => number; export declare const buildQueryString: (data: Record, options?: Record) => string; export declare const parseQueryString: (data: string, options?: Record) => Record; export declare const randomString: (len?: number) => string; export declare const makeSignature: (params: Record, key?: string, type?: string) => string; export declare const isString: (data: any) => boolean; export declare const isArray: (data: any) => boolean; export declare const isNumber: (data: any) => boolean; export declare const isObject: (data: any) => boolean; export declare const isFunction: (data: any) => boolean; export declare const isIpv4: (ip: string) => boolean; export declare const isIpv6: (ip: string) => boolean; export declare const isIp: (ip: string) => boolean; export declare const inArray: (data: any, arr: any, strict?: boolean) => boolean; /** * 类应用混入方法 * @param derivedCtor 目标类 * @param constructors 混入类列表 */ export declare const applyMixins: (derivedCtor: any, constructors: any[]) => void; /** * 去除字符串左右的符号 * @param str 原字符串 * @param chars 要去除的符号,正则字符串,默认空白符 */ export declare const trim: (str: string, chars?: string) => string; /** * 去除字符串左边的符号 * @param str 原字符串 * @param chars 要去除的符号,正则字符串,默认空白符 */ export declare const ltrim: (str: string, chars?: string) => string; /** * 去除字符串右边的符号 * @param str 原字符串 * @param chars 要去除的符号,正则字符串,默认空白符 */ export declare const rtrim: (str: string, chars?: string) => string; /** * 将单词首字母转成大写,'hello word' => 'Hello World' * @param str * @returns */ export declare const strUcwords: (str: string) => string; /** * 将单词首字母转成小写,'Hello World' => 'hello word' * @param str * @returns */ export declare const strLcwords: (str: string) => string; /** * 驼峰(首字母大写),'hello word' => 'HelloWorld' * @param value * @returns */ export declare const strStudly: (value: string) => string; /** * 驼峰(首字母小写),'hello word' => 'helloWorld' * @param value * @returns */ export declare const strCamel: (value: string) => string; /** * 蛇形(下划线分隔,全小写),'helloWorld' => 'hello_world' * @param value * @returns */ export declare const strSnake: (value: string) => string; /** * 如果只有一个同名、同级节点,则不当作数组 * @param obj * @returns */ export declare const singleItem: (obj: any) => any; /** * 解析xml * @param xml * @returns */ export declare const parseXml: (xml: string) => Promise>; /** * 构建xml * @param data 对象 * @param rootName 根节点名,默认:'xml' * @returns */ export declare const buildXml: (data: Record, rootName?: string) => string; /** * 创建UserAgent * @param appends 可选,附加的字符串列表 * @returns */ export declare const createUserAgent: (appends?: string[]) => string; /** * 流转Buffer * @param stream 可读流 */ export declare const streamToBuffer: (stream: Fs.ReadStream) => Promise; /** * Buffer转流 * @param buffer Buffer对象 */ export declare const bufferToStream: (buffer: Buffer) => Stream.Duplex;