Need help with r2?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

4.5K Stars 163 Forks Apache License 2.0 40 Commits 27 Opened issues


HTTP client. Spiritual successor to request.

Services available


Need anything else?

Contributors list


Build Status Coverage Status Greenkeeper badge

Early in Node.js I wrote an HTTP client library called

. It evolved along with Node.js and eventually became very widely depended upon.

A lot has changed since 2010 and I've decided to re-think what a simple HTTP client library should look like.

This new library,

, is a completely new approach from
  • Rather than being built on top of the Node.js Core HTTP library and shimmed for the browser,
    is built on top of the browser's Fetch API and shimmed for Node.js.
  • APIs are meant to be used with async/await, which means they are based on promises.
const r2 = require('r2')

let html = await r2('').text

Simple JSON support.

let obj = {ok: true}

let resp = await r2.put('http://localhost/test.json', {json: obj}).json

Simple headers support.

let headers = {'x-test': 'ok'}

let res = await r2('http://localhost/test', {headers}).response

Being written to the Fetch API is a huge benefit for browser users.

When running through browserify

is ~2M uncompressed and ~500K compressed.
is only 66K uncompressed and 16K compressed.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.