Socket
Book a DemoInstallSign in
Socket

request-as-bluebird

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

request-as-bluebird

promise wrapper for the npm request package

latest
Source
npmnpm
Version
2.1.1
Version published
Maintainers
1
Created
Source

request-as-bluebird

NPM version Build Status Coverage Status

promise wrapper for the npm request package

wraps the npm request package, in a bluebird promise, resolving with an object containing the response and body or rejecting with an Error; also allows you to turn on debugging using the npm request-debug package.

table of contents

installation

npm install request-as-bluebird

usage

getRequestAsBluebird( user_options, debug )

@param {string|Object} user_options
@param {boolean} [debug]
@returns {Promise}

the request package documentation details available user options. you may also want to consider using the generic-request-options package to create the initial user options object.

default

var getRequestAsBluebird = require( 'request-as-bluebird' );

getRequestAsBluebird( 'https://www.google.com' )
  .then(
    /**
     * @param {Object} result
     * @param {IncomingMessage} result.response
     * @param {string} result.body
     */
    function( result ) {
      // handle resolve
    }
  )
  .catch(
    /**
     * @param {Error} err
     */
    function( err ) {
      // handle reject
    }
  );

with request-debug

var getRequestAsBluebird = require( 'request-as-bluebird' );

getRequestAsBluebird( 'https://www.google.com', true )
  .then(
    /**
     * @param {Object} result
     * @param {IncomingMessage} result.response
     * @param {string} result.body
     */
    function( result ) {
      // handle resolve
    }
  )
  .catch(
    /**
     * @param {Error} err
     */
    function( err ) {
      // handle reject
    }
  );

license

MIT License

Keywords

bluebird

FAQs

Package last updated on 07 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts