@magicdawn/rp

lightweight promise api for request

Usage no npm install needed!

<script type="module">
  import magicdawnRp from 'https://cdn.skypack.dev/@magicdawn/rp';
</script>

README

rp

lightweight promise api for request

Build Status Coverage Status npm version npm downloads npm license

Install

npm i @magicdawn/rp --save

API

const rp = require('@magicdawn/rp')

rp()

rp(options)
  .then(([res, body]) => {
    /* blabla */
  })
  .catch(err => {
    /* blabla */
  })

rp.<http-verb>()

rp.get(url, options)
  .then(([res, body]) => {
    /* blabla */
  })
  .catch(err => {
    /* blabla */
  })

rp.createFrom(request)

  • create a rp instance from a request instance
  • the request instance can be require('request') or require('request').defaults()

rp.defaults(options)

same as rp.createFrom(request.defaults(options))

Changelog

CHANGELOG.md

License

the MIT License http://magicdawn.mit-license.org