Wessel Damian Tip 1fe8324714 v0.0.4
2019-01-16 15:37:52 +01:00
2019-01-16 15:28:02 +01:00
2019-01-12 15:17:13 +01:00
2019-01-16 15:37:52 +01:00
2019-01-16 15:35:59 +01:00
2019-01-16 15:28:02 +01:00

Wumpfetch

A lightweight and fast Node.js HTTP client which can be used in various ways

GitHub | NPM

Installing

$ yarn add wumpfetch # Install w/ Yarn (the superior package manager)
$ npm i wumpfetch # Install w/ NPM

Usage

Code
const w = require( 'wumpfetch' );

;( async() => {
	const r = await w( 'https://aws.random.cat/meow' ).send();

	console.log( r.json() );
});
Result
$ node test.js
{ file: 'https://purr.objects-us-east-1.dream.io/i/100_-_rURSo7L.gif' }

Sending data in a JSON body to a server

const w = require( 'wumpfetch' );

;( async() => {
	const r = await w( 'https://my-site.com/postboi', 'POST' )
		.query( 'video', 'wumpboye' )  			       // Add a query
		.header({ 'Authorization': 'Pablito' })		       // Set a header
		.body({ x: 'y', z: 1, beep: 'boop', chocolate: true }) // Send a json body
		.timeout( 1000 )                                       // Set a 1s timeout
		.send();

	console.log( r.json() );
})();

or

const w = require( 'wumpfetch' );

;( async() => {
	const r = await w({
		url: 'https://my-site.com/postboi',
		method: 'GET',
		headers: {
			'Authorization': 'Pablo'
		}
	});

	console.log( r.json() );
})();

or

const w = require( 'wumpfetch' );

;( async() => {
	const r = await w( 'https://my-site.com/postboi', { method: 'GET' });
	console.log( r.json() );
})();

Why should i use wumpfetch?

Wumpfetch is a lightweight and fast request library comparing to other packages such as request and node-fetch which are both around 1.5-4mb in size install size

Description
🚀🔗 A modern, lightweight, fast and easy to use Node.js HTTP client
Readme MIT 163 KiB
Languages
JavaScript 96.9%
TypeScript 3.1%