Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stevenvachon/url-to-options
Convert a WHATWG URL to an http(s).request options object.
https://github.com/stevenvachon/url-to-options
nodejs url whatwg
Last synced: 12 days ago
JSON representation
Convert a WHATWG URL to an http(s).request options object.
- Host: GitHub
- URL: https://github.com/stevenvachon/url-to-options
- Owner: stevenvachon
- License: mit
- Created: 2017-06-06T01:16:44.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2021-02-25T15:48:13.000Z (over 3 years ago)
- Last Synced: 2024-10-23T23:34:20.083Z (21 days ago)
- Topics: nodejs, url, whatwg
- Language: JavaScript
- Size: 4.88 KB
- Stars: 8
- Watchers: 1
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# url-to-options [![NPM Version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]
> Convert a WHATWG [`URL`](https://developer.mozilla.org/en/docs/Web/API/URL) to an `http.request`/`https.request` options object.
## Installation
[Node.js](http://nodejs.org/) `>= 8` is required. To install, type this at the command line:
```shell
npm install url-to-options
```## Usage
```js
const urlToOptions = require('url-to-options');const url = new URL('http://user:pass@hostname:8080/');
const opts = urlToOptions(url);
//-> { auth:'user:pass', port:8080, … }
```[npm-image]: https://img.shields.io/npm/v/url-to-options.svg
[npm-url]: https://npmjs.org/package/url-to-options
[travis-image]: https://img.shields.io/travis/stevenvachon/url-to-options.svg
[travis-url]: https://travis-ci.org/stevenvachon/url-to-options