r2

HTTP client. Spiritual successor to request.

  • 所有者: mikeal/r2
  • 平台:
  • 许可证: Apache License 2.0
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

r2

Build Status Coverage Status Greenkeeper badge

Early in Node.js I wrote an HTTP client library called request. 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, r2, is a completely new approach from request.

  • Rather than being built on top of the Node.js Core HTTP library and
    shimmed for the browser, r2 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('https://www.google.com').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 request is ~2M uncompressed and ~500K compressed. r2 is only 66K uncompressed and 16K compressed.

主要指标

概览
名称与所有者mikeal/r2
主编程语言JavaScript
编程语言JavaScript (语言数: 1)
平台
许可证Apache License 2.0
所有者活动
创建于2017-08-30 23:50:18
推送于2019-09-01 16:23:58
最后一次提交2018-05-27 19:01:38
发布数3
最新版本名称v2.0.1 (发布于 )
第一版名称v1.1.0 (发布于 )
用户参与
星数4.4k
关注者数59
派生数115
提交数40
已启用问题?
问题数50
打开的问题数21
拉请求数20
打开的拉请求数9
关闭的拉请求数8
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?