Giter Club home page Giter Club logo

sv_node_share's Introduction

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('[email protected]');

sv_node_share's People

Contributors

jellyw avatar nothingyf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.