Request transform option

I’m sorry if this is something obvious that I’m missing, but I’m starting a project using request-promise and cheerio.

The request-promise documentation gives this example:

var options = {
    uri: 'http://www.google.com',
    **transform**: function (body) {
        return cheerio.load(body);
    }
};

rp(options)
    .then(function ($) {
        // Process html like you would with jQuery...
    })
    .catch(function (err) {
        // Crawling failed or Cheerio choked...
    });

And I just can’t find out what is the “transform” option. This is from request, JS, cheerio? Where is the documentation for this?

  • transform which takes a function to transform the response into a custom value with which the promise is resolved