# unxhr

> Synchronous and asynchronous XMLHttpRequest for Node

Latest version **1.2.0** (published 2021-02-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install unxhr
pnpm add unxhr
yarn add unxhr
bun add unxhr
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2021-02-11 |
| First published | 2018-12-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.11 |
| Dependencies | 0 |
| Unpacked size | 25.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | ggrossetie |
| Keywords | xhr, ajax, sync, http |

## Links

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

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2021-02-11
- 1.1.1 — 2021-01-05
- 1.1.0 — 2020-11-14
- 1.0.4 — 2020-05-17
- 1.0.3 — 2020-05-17
- 1.0.2 — 2020-05-17
- 1.0.1 — 2018-12-20
- 1.0.0 — 2018-12-20

## README

> Synchronous and asynchronous XMLHttpRequest for Node

[![Build](https://github.com/Mogztter/unxhr/workflows/Build/badge.svg)](https://github.com/Mogztter/unxhr/actions?query=workflow%3ABuild)
[![install size](https://packagephobia.now.sh/badge?p=unxhr)](https://packagephobia.now.sh/result?p=unxhr)
[![npm version](https://img.shields.io/npm/v/unxhr)](https://www.npmjs.com/package/unxhr)

_unxhr_ is a tiny wrapper of the built-in `http` client to emulate the browser `XMLHttpRequest` object.

**Important:** This library is a fork of [XMLHttpRequest](https://github.com/driverdan/node-XMLHttpRequest).
It was created to be compliant with [XMLHttpRequest Level 2](http://www.w3.org/TR/XMLHttpRequest2/).

## Highlights

- Dependency free
- Asynchronous and synchronous requests
- `GET`, `POST`, `PUT`, and `DELETE` requests
- Binary data using JavaScript typed arrays
- Follows redirects
- Handles `file://` protocol

## Usage

Here's how to include the module in your project and use as the browser-based XHR object.

```js
const XMLHttpRequest = require('unxhr').XMLHttpRequest
const xhr = new XMLHttpRequest()
```

## Known Issues / Missing Features

For a list of open issues or to report your own visit the [github issues page](https://github.com/Mogztter/unxhr/issues).

* Local file access may have unexpected results for non-UTF8 files
* Synchronous requests don't set headers properly
* Synchronous requests freeze node while waiting for response (But that's what you want, right? Stick with async!).
* Some events are missing, such as abort
* Cookies aren't persisted between requests
* Missing XML support

## License

MIT license. See LICENSE for full details.

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