{"id":17472567,"url":"https://github.com/shinnn/node-http-s","last_synced_at":"2025-03-28T08:11:05.963Z","repository":{"id":18641093,"uuid":"21847611","full_name":"shinnn/node-http-s","owner":"shinnn","description":"Returns built-in http or https module accordingly to the protocol name","archived":false,"fork":false,"pushed_at":"2014-12-29T14:29:06.000Z","size":248,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-18T19:57:51.850Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shinnn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-15T05:34:48.000Z","updated_at":"2014-12-29T14:28:47.000Z","dependencies_parsed_at":"2022-09-11T03:33:03.819Z","dependency_job_id":null,"html_url":"https://github.com/shinnn/node-http-s","commit_stats":null,"previous_names":["shinnn/http-s"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fnode-http-s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fnode-http-s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fnode-http-s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fnode-http-s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinnn","download_url":"https://codeload.github.com/shinnn/node-http-s/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245991582,"owners_count":20706129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-18T17:27:09.064Z","updated_at":"2025-03-28T08:11:05.940Z","avatar_url":"https://github.com/shinnn.png","language":"JavaScript","readme":"# http-s \n\n[![NPM version](https://img.shields.io/npm/v/http-s.svg?style=flat)](https://www.npmjs.com/package/http-s)\n[![Bower version](https://img.shields.io/bower/v/http-s.svg?style=flat)](https://github.com/shinnn/node-http-s/releases)\n[![Build Status](https://travis-ci.org/shinnn/node-http-s.svg?branch=master)](https://travis-ci.org/shinnn/node-http-s)\n[![Build status](https://ci.appveyor.com/api/projects/status/ygrt2hgh5iba4jtt?svg=true)](https://ci.appveyor.com/project/ShinnosukeWatanabe/node-http-s)\n[![Coverage Status](https://img.shields.io/coveralls/shinnn/node-http-s.svg?style=flat)](https://coveralls.io/r/shinnn/node-http-s)\n[![devDependency Status](https://david-dm.org/shinnn/node-http-s/dev-status.svg)](https://david-dm.org/shinnn/node-http-s#info=devDependencies)\n\nA [Node](http://nodejs.org/) module to load the [http][http] or [https][https] module accordingly to the protocol name\n\n```javascript\nvar httpOrHttps = require('http-s');\n\nhttpOrHttps('http://nodejs.org/'); // equivalent of `require('http')`\nhttpOrHttps('https://www.npmjs.com/'); // equivalent of `require('https')`\nhttpOrHttps({protocol: 'http:'}); // equivalent of `require('http')`\n```\n\n## Installation\n\n### [npm](https://www.npmjs.com/)\n\n```sh\nnpm install http-s\n```\n\n### [bower](http://bower.io/)\n\n```sh\nbower install http-s\n```\n\n## API\n\n```javascript\nvar httpOrHttps = require('http-s');\n```\n\n### httpOrHttps(*urlObject*)\n\n*urlObject*: `Object` (which has `protocol` property)  \nReturn: [http][http] or [https][https]\n\nIt returns [http][http] module if the `protocol` property is `\"http:\"`, or returns [https][https] module if the property is `\"https:\"`.\n\n```javascript\nhttpOrHttps({protocol: 'https:'}); //=\u003e https\n\nvar url = require('url');\nvar options = url.parse('http://nodejs.org/api/url.html');\n// =\u003e {protocol: 'http:', slashes: true, auth: null, ...}\n\nhttpOrHttps(options); //=\u003e http\n```\n\n### httpOrHttps(*urlString*)\n\n*urlString*: `String`  \nReturn: [http][http] or [https][https]\n\nWhen it takes a string as an argument instead of an object, it automatically parses the string with [`url.parse()`](http://nodejs.org/api/url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost).\n\n```javascript\nhttpOrHttps('http://nodeschool.io/'); //=\u003e http\n```\n\n## License\n\nCopyright (c) 2014 [Shinnosuke Watanabe](https://github.com/shinnn)\n\nLicensed under [the MIT License](./LICENSE).\n\n[http]: http://nodejs.org/api/http.html#http_http\n[https]: http://nodejs.org/api/https.html#https_https\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fnode-http-s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinnn%2Fnode-http-s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fnode-http-s/lists"}