Skip to content

Instantly share code, notes, and snippets.

Last active Nov 11, 2015
What would you like to do?
Bluebird map + bhttp
var Promise = require("bluebird");
var bhttp = require("bhttp");
return bhttp.get("");
return response.body.toString().split("\n");
return bhttp.get(url);
return response.body;
/* arrayOfResponses now contains all the HTTP responses for each URL in the all-the-urls.txt file! */
/* You would normally NOT have a catch-all error handler like this - this is purely for the sake
* of example. Normally, your error handlers would only catch those errors that it is specfically
* interested in; an example of this is at */
console.log("An error occurred!", err);

This comment has been minimized.

Copy link

@dunielpls dunielpls commented Aug 6, 2015


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment