sv_node_share

1.1.28 • Public • Published

sv_node_share

sv node share

build status

安装

需要node v7.6.0以上版本支持

 
npm set registry http://npm.scsv.online
npm install sv_node_share --save

Usage

Cache

 
const cache = require('sv_node_share').cache;
 
 
//初始化缓存,需在程序初始化时调用
cache.init('127.0.0.1', 6379, 0);
 
//设置缓存
cache.set('123', {id: '123'}, 60)
 
//获取缓存
cache.get('123');
 
//设置缓存失效时间
cache.expire('123', 60);
 
//删除缓存
cache.del('123')
 
//获取所有匹配键值
cache.keys('123*')
 

logger

 
const logger = require('sv_node_share').logger('test:server')
 
logger.info('hello');
logger.warn('hello');
logger.error('hello');
 

request

 
const request = require('sv_node_share').request;
 
await request.call('http://www.baidu.com');
 
await request.jsoncall('http://locahost:9000/jsontest', { id: '123' });
 
await request.getBase64(image_url);

tools

 
const request = require('sv_node_share').tools;
 
tools.isJSON({id: '123'});
await tools.sleep(1000);
await tools.exec('netstat -an');
tools.sysinfo();
 

validate

 
const validate = require('sv_node_share').validate;
 
validate.isMobile('13600000000');
validate.isQQ('1234567');
validate.isEmail('a@a.com');
 

Readme

Keywords

Package Sidebar

Install

npm i sv_node_share

Weekly Downloads

2

Version

1.1.28

License

MIT

Unpacked Size

59.8 kB

Total Files

26

Last publish

Collaborators

  • nothingdocker