JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 100222
  • Score
    100M100P100Q157899F
  • License MIT

Synchronous and asynchronous XMLHttpRequest for Node

Package Exports

  • unxhr

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (unxhr) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Synchronous and asynchronous XMLHttpRequest for Node

Build install size npm version

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. It was created to be compliant with XMLHttpRequest Level 2.

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.

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.

  • 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.