1.0.0 • Published 12 years ago

promised-request v1.0.0

Weekly downloads
25
License
-
Repository
github
Last release
12 years ago

A wrapper for Mikeals request module, that returns a promise

Usually you can use promised-io.promise.convertNodeAsyncFunction to convert any function to a promise returning function. But convertNodeAsyncFunction is smart and figures out that request returns two success values - response and body - and therefore emits an array. since you can get to the body argument of request also by response.body, that is the only success value you need. and that is what this wrapper method does.

Usage:

var request = require( 'promised-request' );
request( 'http://sifu.io' ).then( function( response ) { console.info( response.body ) } );