# commons-http

> Library for http request backend abstraction.

Latest version **1.0.7** (published 2019-07-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install commons-http
pnpm add commons-http
yarn add commons-http
bun add commons-http
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2019-07-27 |
| First published | 2019-04-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 41.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Robert Kania |
| Maintainers | cezaryrk |
| Keywords | commons, typescript, http |

## Links

- npm: https://www.npmjs.com/package/commons-http
- Repository: https://github.com/thinkbaer/node-commons-http
- Homepage: https://github.com/thinkbaer/node-commons-http#readme
- Issues: https://github.com/thinkbaer/node-commons-http/issues
- npm.io page: https://npm.io/package/commons-http

## Dependencies (1)

- [commons-base](https://npm.io/package/commons-base.md) ^1.1.2

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.7 (latest) — 2019-07-27
- 1.0.5 — 2019-07-15
- 1.0.4 — 2019-07-11
- 1.0.3 — 2019-07-09
- 1.0.2 — 2019-07-09
- 1.0.1 — 2019-05-03
- 1.0.0 — 2019-04-30

## README

# node-commons-http

[![Build Status](https://travis-ci.org/thinkbaer/node-commons-http.svg?branch=master)](https://travis-ci.org/thinkbaer/node-commons-http)
[![codecov](https://codecov.io/gh/thinkbaer/node-commons-http/branch/master/graph/badge.svg)](https://codecov.io/gh/thinkbaer/node-commons-http)
[![Dependency Status](https://david-dm.org/thinkbaer/node-commons-http.svg)](https://david-dm.org/thinkbaer/node-commons-http)

This is a abstract implementation for a generic http requests api, which can
be backed by different implementations. Like got, request, node-fetch or others.

The default implementation is uses got package. 

## Install

```js
npm i commons-http got
```

## Usage

```js
import {HttpFactory, IHttpResponse, IHttp, IHttpStream} from "commons-http";

let httpFactory = await HttpFactory.load();
let http:IHttp = httpFactory.create();

// use as promise
let resp:IHttpResponse<any> = await http.get('http://example.com');
console.log(resp.body)

// use as stream
let stream:IHttpStream<any> = http.get('http://example.com',{stream:true});
stream.pipe(fs.createWriteStream('test.file'));

await stream.asPromise()
```

---
_Source: https://npm.io/package/commons-http · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
