Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fetch: function (location, options, callback) {
!callback && _.isFunction(options) && (callback = options, options = {});
return (/^https?:\/\/.*/).test(location) ?
// Load from URL
request.get({ url: location }, (err, response, body) => {
if (err) {
return callback(err);
}
return callback(null, body);
}) :
fs.readFile(location, function (err, value) {
if (err) {
return callback(err);
}
return callback(null, value.toString());
});
},