request-lightweight-alternative

1.0.1 • Public • Published

A Lightweight Drop-in Replacement for Request

We all love request, but it's really, really overweight.

There are tons of alternatives, but none that you can just swap out.

Meet uRequest

npm install --save @coolaj86/urequest
var request = require('@coolaj86/urequest');
request('http://www.google.com', function (error, response, body) {
  console.log('error:', error); // Print the error if one occurred
  console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
  console.log('body:', body); // Print the HTML for the Google homepage.
});

Supports the same convenience methods (get, post, put, patch, delete) with the same API, including

  • Redirects
  • Forms
    • x-www-form-urlencoded
    • multipart/form-data
    • application/json
  • Custom HTTP Headers
  • Unix Domain Sockets

Dependencies are kept optional, so you only download and load into memory what you need.

Read the docs: https://git.ppl.family/ppl/urequest.js.git

Aren't there are tons of alternatives?

Yes

  • needle
  • got
  • axios
  • SuperAgent
  • http/https

Some of them are even lightweight and/or zero dependency.

However, none of them Just Work TM when your goal is to trim your tiny little library with nearly no dependencies down to a manageable size.

request has dozens upon dozens of dependencies to support 90% of the features that you don't use even 10% of the time. But since sometimes you do need them, it's nice to have an alternative that let's you progressively add them.

Package Sidebar

Install

npm i request-lightweight-alternative

Weekly Downloads

1

Version

1.0.1

License

(MIT OR Apache-2.0)

Unpacked Size

2.08 kB

Total Files

3

Last publish

Collaborators

  • coolaj86