npm.io
0.2.1 • Published 10 years ago

nano-fetch

Licence
MIT
Version
0.2.1
Deps
0
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

nano-fetch

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

It's based on XMLHttpRequest so refer to its documentation for the expected output. It defaults to JSON output and GET requests.

gzipped size

Usage

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

With browserify

npm install --save nano-fetch
var nanoFetch = require('nano-fetch');

API

nanoFetch(url[, options])
  • url is an absolute or relative URL
  • options is an object with the properties:

Dependencies

None

License

MIT Federico Brigante

Keywords