Hi, I'm new in NodeJS (started 2 days ago) and the first project i'm trying to do is a youtube downloader webpage (done with express, ytdl-core)What i do to download the video is create a fs.stream ? (idk much about this), and when my file is created in local, use res.download to download the file propery, the code is here:app.post('/download', async (req, res, next) => {try {let videoUrl = req.body.videoLink;const info = await ytdl.getInfo(videoUrl.substr(videoUrl.length - 11));const video = ytdl(videoUrl, { quality: 'highest' }).pipe(fs.createWriteStream(\videos/${info.videoDetails.title}.mp4`))`video.on('close', () => res.download(video.path));}catch (err){res.end(err);}})So, the problem here is that in localhost works all perfect, but when i host my project in heroku, it gets an error and I dont know exactly what to do. I read is something about dynos but not sure, and if that is the reason, what I could do to fix that :(what i have done for now: https://twitter.com/Covicale/status/1295411270515130370
Submitted August 17, 2020 at 06:53PM by Esrubialex
No comments:
Post a Comment