import * as _crypto from "./util/crypto" import * as mysqlHelper from "./util/mysql/mysqlHelper" import * as _tool from "./util/tool" import * as redisHelper from './util/redis/redisHelper' import * as _mail from './util/email' import * as _schedule from "./util/schedule" import * as _IPBlock from "./util/ipBlock" import * as _resCode from "./util/resCode" import * as _multer from "./util/multer" import * as _captcha from "./util/captcha" import * as _JWT from "./util/jwt" import * as _ws from "./util/ws" import * as _process from "./util/process" import * as _snowFlakeID from "./util/snowFlakeId" import * as _compress from "./util/compress" import * as _sms from "./util/sms" import * as _file from "./util/file" import ES from "./util/elasticsearch" import * as _tesseract from "./util/tesseract" /** * pormise异步封装方式 * * @export * @param {Promise<[]>} promise 传入一个promise方法 * @returns 正常返回 [null,data]结构,错误异常返回 [err] 结构 */ export function to(promise: Promise) { return promise.then(data => { return [null, data] }) .catch(err => [err]) } export const crypto: _crypto.Crypto = _crypto; // 导出crypto方法对象 export const tool: _tool.Tool = _tool; //导出tool方法对象 export const mysql: mysqlHelper.Mysql = mysqlHelper export const redis: redisHelper.Redis = redisHelper export const mail: _mail.NodeMail = _mail export const schedule: _schedule.nodeSchedule = _schedule export const ipBlock: _IPBlock.IPBlock = _IPBlock export const resCode: _resCode.resCode = _resCode export const multer: _multer.Multer = _multer export const captcha: _captcha.svgCaptcha = _captcha export const JWT: _JWT.JWT = _JWT export const WS: _ws.webSocket = _ws export const M_Process: _process.M_Process = _process; export const snowFlakeID: _snowFlakeID.snowFlakeID = _snowFlakeID export const compress: _compress.compress = _compress export const file: _file.File = _file export const es = ES export const tessseract: _tesseract.tesseract = _tesseract