# tool-helper **Repository Path**: chrunlee/tool-helper ## Basic Information - **Project Name**: tool-helper - **Description**: Some simple functions that are commonly used in life or office.About fs / http / ffmpeg / message / logger - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-01-21 - **Last Updated**: 2024-01-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # tool-helper Some simple functions that are commonly used in life or office.About fs / http / ffmpeg / message / logger . ## Install ```shell npm i tool-helper --save ``` ## Usage ### common ```javascript import {common} from 'tool-helper' const { //node-uuid uuid, //crypto md5 md5, //setTimeout in promise sleep, //get a datetime string datetime, //get a human readable size like 20MB humanSize, //get a human readable time like 20 minutes ago getHumanTime, //readable stream pipe to write stream rs2ws } = common; ``` ### download ```javascript //node-fetch import {download} from 'tool-helper' let ins = new download('https://minioapi.byyui.com:9999/zztemp/test.mp4','./test.mp4'); //download progress ins.on('progress',info=>{ console.log(info); }); let rs = await ins.download(); //or json / html / post / m3u8 ``` ### ffmpeg ```javascript import {ffmpeg} from 'tool-helper' const {getImage,getM3u8,getVideo} = ffmpeg; //Please install ffmpeg on os before using it //through 'child_process' call ffmpeg bin ``` ### fileutil ```javascript import {fileutil} from 'tool-helper' const {mkdir,existsFile,isFile,deldir,listFiles,getMd5,base64} = image; //these functions just like these names,but dit not do any safe check ``` ### logger ```javascript import {getLogger} from 'tool-helper' //log4js const logger = getLogger('test'); logger.info('some message'); ``` ### useragent ```javascript import {useragent} from 'tool-helper' const { //get a random useragent like 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36' getRandom, //get a device information throuth useragent devices } = useragent; ``` ### message ```javascript //dingtalk and mail import {message} from 'tool-helper' const {dingding,mail} = message; ``` ## License The MIT LICENSE.