(node:4148) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cant set headers after they are sent. (node:4148) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
{ fs.readFile('public/html/sucess.html', function (err, data) { res.write(data); res.end(); }); webtrfy(downloadLink) .then(function (buffer) { console.log('creating the file'); //------------------------------------------- res.setHeader('Content-Type', 'application/x-trt'); res.setHeader('Content-Disposition', `inline; filename="${fileName}.trt"`); res.setHeader('Cache-Control', 'public, max-age=2592000'); // 30 days res.send(buffer); console.log(fileName +'.trt created'); res.end(); //------------------------------------------- }); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)