Compare commits

..

No commits in common. "2e9a643c0f6991490d9aa3d66a2e156c973e7a13" and "ed2bab931f4960650a8a3e17c2c18788ffae5e46" have entirely different histories.

2 changed files with 13 additions and 35 deletions

View File

@ -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
}

View File

@ -76,19 +76,6 @@ function setDefaults(defs) {
var req; var req;
var finalOpts = {}; 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) { function onResponse(resp) {
var followRedirect; var followRedirect;
@ -164,6 +151,19 @@ function setDefaults(defs) {
reject = _reject; 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 // or an existing write stream
if ('function' === typeof opts.stream.pipe) { if ('function' === typeof opts.stream.pipe) {
if (opts.debug) { if (opts.debug) {