# nano-fetch

> A tiny window.fetch-like promise-based AJAX implementation.

Latest version **0.2.1** (published 2016-04-22) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install nano-fetch
pnpm add nano-fetch
yarn add nano-fetch
bun add nano-fetch
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2016-04-22 |
| First published | 2016-04-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Federico Brigante |
| Maintainers | bfred-it |
| Keywords | ajax, xhr, XMLHttpRequest, fetch, promise, json, post, get |

## Links

- npm: https://www.npmjs.com/package/nano-fetch
- Repository: https://github.com/bfred-it/nano-fetch
- Homepage: https://github.com/bfred-it/nano-fetch#readme
- Issues: https://github.com/bfred-it/nano-fetch/issues
- npm.io page: https://npm.io/package/nano-fetch

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.2.1 (latest) — 2016-04-22
- 0.2.0 — 2016-04-22
- 0.1.0 — 2016-04-22

## README

# nano-fetch 

> A tiny window.fetch-like promise-based AJAX implementation

It's based on `XMLHttpRequest` so refer to [its documentation](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) for the expected output. It defaults to JSON output and GET requests.

[![gzipped size](https://badges.herokuapp.com/size/github/bfred-it/nano-fetch/master/dist/nano-fetch.browser.js?gzip=true&label=gzipped%20size)](#readme)

## Usage

```js
nanoFetch('page.php').then(function (jsonResponse) {
	//...
}).catch(function (error) {
	//...
});
```

```js
nanoFetch('page.php', {
	responseType: 'document',
	method: 'POST'
}).then(function (documentElement) {
	//...
}).catch(function (error) {
	//...
});
```

## With browserify

```sh
npm install --save nano-fetch
```

```js
var nanoFetch = require('nano-fetch');
```

## API

### `nanoFetch(url[, options])`

- `url` is an absolute or relative URL
- `options` is an object with the properties:
  - [`responseType`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType)
  - [`method`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Parameters)

## Dependencies

None

## License

MIT © [Federico Brigante](http://twitter.com/bfred_it)

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