0.0.6 • Published 4 months ago

tool-helper v0.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

tool-helper

Some simple functions that are commonly used in life or office.About fs / http / ffmpeg / message / logger .

Install

npm i tool-helper --save

Usage

common

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

//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

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

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

import {getLogger} from 'tool-helper'
//log4js
const logger = getLogger('test');
logger.info('some message');

useragent

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

//dingtalk and mail
import {message} from 'tool-helper'
const {dingding,mail} = message;

License

The MIT LICENSE.

0.0.3

4 months ago

0.0.5

4 months ago

0.0.4

4 months ago

0.0.6

4 months ago

0.0.1

4 months ago

0.0.2

4 months ago

1.6.0

1 year ago

1.5.2

2 years ago

1.4.3

2 years ago

1.5.1

2 years ago

1.4.2

2 years ago

1.5.0

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago