Rozbot/lib/promise/fetch.js
2016-07-11 23:24:15 -04:00

13 lines
330 B
JavaScript

var fetch = require('fetch').fetchUrl;
var promise = require('promise-polyfill');
module.exports = function(link, options) {
return new promise(function(resolve, reject) {
fetch(link, options, function(error, meta, body) {
if (error) {
reject(error);
} else {
resolve({meta: meta, body: body});
}
});
});
}