Compare commits
No commits in common. "2e9a643c0f6991490d9aa3d66a2e156c973e7a13" and "ed2bab931f4960650a8a3e17c2c18788ffae5e46" have entirely different histories.
2e9a643c0f
...
ed2bab931f
22
.jshintrc
22
.jshintrc
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"esversion": 11,
|
||||
"curly": true,
|
||||
"sub": true,
|
||||
"bitwise": true,
|
||||
"eqeqeq": true,
|
||||
"forin": true,
|
||||
"freeze": true,
|
||||
"immed": true,
|
||||
"latedef": "nofunc",
|
||||
"nonbsp": true,
|
||||
"nonew": true,
|
||||
"plusplus": true,
|
||||
"undef": true,
|
||||
"unused": "vars",
|
||||
"strict": true,
|
||||
"maxdepth": 3,
|
||||
"maxstatements": 100,
|
||||
"maxcomplexity": 40
|
||||
}
|
26
index.js
26
index.js
|
@ -76,19 +76,6 @@ function setDefaults(defs) {
|
|||
var req;
|
||||
var finalOpts = {};
|
||||
|
||||
// allow specifying a file
|
||||
if ('string' === typeof opts.stream) {
|
||||
if (opts.debug) {
|
||||
console.debug('[@root/request] creating file write stream');
|
||||
}
|
||||
try {
|
||||
opts.stream = fs.createWriteStream(opts.stream);
|
||||
} catch (e) {
|
||||
cb(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function onResponse(resp) {
|
||||
var followRedirect;
|
||||
|
||||
|
@ -164,6 +151,19 @@ function setDefaults(defs) {
|
|||
reject = _reject;
|
||||
});
|
||||
|
||||
// allow specifying a file
|
||||
if ('string' === typeof opts.stream) {
|
||||
try {
|
||||
if (opts.debug) {
|
||||
console.debug(
|
||||
'[@root/request] file write stream created'
|
||||
);
|
||||
}
|
||||
opts.stream = fs.createWriteStream(opts.stream);
|
||||
} catch (e) {
|
||||
cb(e);
|
||||
}
|
||||
}
|
||||
// or an existing write stream
|
||||
if ('function' === typeof opts.stream.pipe) {
|
||||
if (opts.debug) {
|
||||
|
|
Loading…
Reference in New Issue