const downloadFile = (url, stream, callback) => {
http.get(url, (response) => {
response
.pipe(stream)
.on('finish', () => callback(null))
}).on('error', callback)
};
// Пример
file = fs.createWriteStream(`main.pdf`);
downloadFile(pdfUrl, file, conv);