http-s是一个模块,用于根据协议名称加载或模块。


var httpOrHttps = require('http-s');

httpOrHttps('http://nodejs.org/'); // equivalent of `require('http')`

httpOrHttps('https://www.npmjs.com/'); // equivalent of `require('https')`

httpOrHttps({ protocol: 'http:' }); // equivalent of `require('http')`

安装:


npm install http-s

bower install http-s

应用程序接口


var httpOrHttps = require('http-s');

httpOrHttps('http://nodejs.org/'); // equivalent of `require('http')`

httpOrHttps('https://www.npmjs.com/'); // equivalent of `require('https')`