https://github.com/rajikaimal/http-fetcher
:zap: Minimal effort for http requests
https://github.com/rajikaimal/http-fetcher
get http
Last synced: about 1 year ago
JSON representation
:zap: Minimal effort for http requests
- Host: GitHub
- URL: https://github.com/rajikaimal/http-fetcher
- Owner: rajikaimal
- License: mit
- Created: 2016-08-22T19:26:16.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-06-10T11:37:13.000Z (almost 8 years ago)
- Last Synced: 2025-03-08T17:03:15.538Z (about 1 year ago)
- Topics: get, http
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# http-fetcher [](https://travis-ci.org/rajikaimal/http-fetcher)
:zap: Minimal effort for http requests
Most of the time small modules require only GET requests to function. Using full fledged packages like [request](https://www.npmjs.com/package/request) in small modules can take over space in your project unnecessarily.
http-fetcher focuses only on fetching data (GET requests)
Size comparison : request `>100KiB`, http-fetcher `<15KiB`
> works only for fetching data [GET requests only]
## Install
```
npm install --save http-fetcher
```
## Usage
```js
const httpFetcher = require('http-fetcher');
httpFetcher('api.github.com', '/users/gaearon/orgs', { 'User-Agent': 'github-organizations' }, 'https')
.then((res) => {
console.log(res);
});
```
## API
### get(hostname, path, headers, protocol)
Returns a promise
#### hostname
Type: `string`
Hostname for requesting resource
#### path
Type: `string`
Path for requesting resource
#### headers [optional]
Type: `object`
http headers
#### protocol
Type: `string`
requesting protocol (http/https)
## License
MIT © [Rajika Imal](https://rajikaimal.github.io)