# promise-xhr

> Wrapper for the XHR package

Latest version **1.0.1** (published 2016-11-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install promise-xhr
pnpm add promise-xhr
yarn add promise-xhr
bun add promise-xhr
```

## 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.1 |
| Published | 2016-11-20 |
| First published | 2016-11-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Bjarne Oeverli |
| Maintainers | bjarneo |
| Keywords | xhr, xdr, promise, wrapper, ie8, ie9 |

## Links

- npm: https://www.npmjs.com/package/promise-xhr
- Repository: https://github.com/bjarneo/promise-xhr
- Homepage: https://github.com/bjarneo/promise-xhr#readme
- Issues: https://github.com/bjarneo/promise-xhr/issues
- npm.io page: https://npm.io/package/promise-xhr

## Dependencies (1)

- [xhr](https://npm.io/package/xhr.md) ^2.2.2

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-11-20
- 1.0.0 — 2016-11-15

## README

Promise XHR (xdr)
======
This is a Promise XHR wrapper. Uses [https://www.npmjs.com/package/xhr](https://www.npmjs.com/package/xhr) under the hood.

NOTE
--
For older browsers you need a promise polyfill. [https://www.npmjs.com/package/promise-polyfill](https://www.npmjs.com/package/promise-polyfill)

Installation
--
```bash
$ npm i --save promise-xhr
```

Usage
--
```js
const xhr = require('promise-xhr');
const api = 'https://api.github.com';

// Options available:
// https://www.npmjs.com/package/xhr#var-req--xhroptions-callback
const options = {};

// Basic get request
xhr(api)
    .then(res => console.log(res))
    .catch(err => console.error(err));

// With options
xhr(api, {
    method: 'POST',
    useXDR: true
})
    .then(res => console.log(res)
    .catch(err => console.error(err));

// Available methods: get, post, put, patch, del, head
xhr.get(api).then(console.log).catch(console.error);
xhr.post(api, options).then(console.log).catch(console.error);

```

XHR package docs
--
[https://www.npmjs.com/package/xhr](https://www.npmjs.com/package/xhr)

Contribution
--
Contributions are appreciated.

License
--
MIT-licensed. See LICENSE.

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