You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 837B

1234567891011121314151617181920212223242526272829
  1. # url-to-options [![NPM Version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]
  2. Convert a WHATWG [URL](https://developer.mozilla.org/en/docs/Web/API/URL) to an `http.request`/`https.request` options object.
  3. ## Installation
  4. [Node.js](http://nodejs.org/) `>= 4` is required. To install, type this at the command line:
  5. ```shell
  6. npm install url-to-options
  7. ```
  8. ## Usage
  9. ```js
  10. const urlToOptions = require('url-to-options');
  11. const url = new URL('http://user:pass@hostname:8080/');
  12. const opts = urlToOptions(url);
  13. //-> { auth:'user:pass', port:8080, … }
  14. ```
  15. [npm-image]: https://img.shields.io/npm/v/url-to-options.svg
  16. [npm-url]: https://npmjs.org/package/url-to-options
  17. [travis-image]: https://img.shields.io/travis/stevenvachon/url-to-options.svg
  18. [travis-url]: https://travis-ci.org/stevenvachon/url-to-options