waspothegreat / node-superfetch

A wrapper for node-fetch that makes it appear like superagent.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node-superfetch

Downloads Version Travis

node-superfetch is a tiny little wrapper for node-fetch that makes it look like you are using superagent. It arose after I decided I disliked the node-fetch API and loved the superagent API, but node-fetch is smaller than superagent and snekfetch is buggy (and this probably is too).

Basic Usage

const request = require('node-superfetch');

try {
	const { body } = await request.get('https://registry.npmjs.com/node-fetch');
	console.log(body);
} catch (err) {
	console.error(err);
}

Usage is basically that of superagent or snekfetch, and implements the same HTTP methods, as well as functions like query (sets query parameters), set (sets headers), send (for adding POST data and such), attach (for sending FormData), redirects (for setting the allowed number of redirects), and agent (for setting the HTTP agent). end is also supported for callbacks.

About

A wrapper for node-fetch that makes it appear like superagent.

License:Other


Languages

Language:JavaScript 100.0%