Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
bodyBuffers.push(chunk);
});
form.on('error', function (err) {
loc.success = false;
loc.message = err.message;
res.json(loc);
return;
});
form.append('file', response.body, {
header: '--' + form.getBoundary() + FormData.LINE_BREAK +
'Content-Disposition: form-data; name=file' +
'; filename=file' + FormData.LINE_BREAK +
'Content-Transfer-Encoding: binary' + FormData.LINE_BREAK +
'Content-Type: ' + response.headers['content-type'] +
'; name=file' + FormData.LINE_BREAK + FormData.LINE_BREAK
});
form.resume();
}));
});
}));
});
form.on('data', function (chunk) {
if (typeof(chunk) === 'string') {
chunk = new Buffer(chunk, 'binary');
}
bodyBuffers.push(chunk);
});
form.on('error', function (err) {
loc.success = false;
loc.message = err.message;
res.json(loc);
return;
});
form.append('file', response.body, {
header: '--' + form.getBoundary() + FormData.LINE_BREAK +
'Content-Disposition: form-data; name=file' +
'; filename=file' + FormData.LINE_BREAK +
'Content-Transfer-Encoding: binary' + FormData.LINE_BREAK +
'Content-Type: ' + response.headers['content-type'] +
'; name=file' + FormData.LINE_BREAK + FormData.LINE_BREAK
});
form.resume();
}));
});