gulp-remote-src
Advanced tools
Comparing version 0.4.2 to 0.4.3
16
index.js
@@ -8,3 +8,3 @@ var util = require('util'); | ||
module.exports = function(urls, options) { | ||
module.exports = function (urls, options) { | ||
if (options === undefined) { | ||
@@ -14,3 +14,3 @@ options = {}; | ||
if (typeof options.base !== 'string' ) { | ||
if (typeof options.base !== 'string' && options.base !== null) { | ||
options.base = '/'; | ||
@@ -27,4 +27,4 @@ } | ||
var allowedRequestOptions = ['qs', 'headers', 'auth', 'followRedirect', 'followAllRedirects', 'maxRedirects', 'timeout', 'proxy', | ||
'strictSSL', 'aws', 'gzip'] | ||
var allowedRequestOptions = ['qs', 'headers', 'auth', 'followRedirect', 'followAllRedirects', 'maxRedirects', 'timeout', 'proxy', | ||
'strictSSL', 'aws', 'gzip']; | ||
@@ -46,3 +46,3 @@ var requestBaseOptions = {}; | ||
return es.readArray(urls).pipe(es.map(function(data, cb) { | ||
var url = options.base + data, requestOptions = extend({url: url}, requestBaseOptions); | ||
var url = [options.base, data].join(''), requestOptions = extend({url: url}, requestBaseOptions); | ||
@@ -63,3 +63,3 @@ if (!options.buffer) { | ||
request(requestOptions, function(error, response, body) { | ||
request(requestOptions, function (error, response, body) { | ||
if (!error && (response.statusCode >= 200 && response.statusCode < 300)) { | ||
@@ -75,3 +75,3 @@ var file = new File({ | ||
if (!error) { | ||
error = new Error("Request " + url + " failed with status code:" + response.statusCode); | ||
error = new Error('Request ' + url + ' failed with status code:' + response.statusCode); | ||
} | ||
@@ -83,2 +83,2 @@ cb(error); | ||
})); | ||
}; | ||
}; |
{ | ||
"name": "gulp-remote-src", | ||
"description": "Remote gulp.src", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -36,8 +36,11 @@ # gulp-remote-src | ||
If you want to use absolute urls instead of relative ones, set this to | ||
`null`. When not configured, `/` is assumed. | ||
- `buffer` (default is true) | ||
Pipe out files as buffer or as stream. Note that some plugins does not support streaming. | ||
Pipe out files as buffer or as stream. Note that some plugins do not support streaming. | ||
- `requestOptions` | ||
Options to be passed to [request](https://github.com/mikeal/request) | ||
Options to be passed to [request](https://github.com/mikeal/request) |
8157
147
46