'Download a File in the client's downloads folder (NodeJS)

I have a project in Node where I put a Youtube video URL and then I download it. Now it works, but I have the next problem: when I download a video from another PC (in the same LAN), the video goes to the main PCs downloads folder. For example, i deploy the app in my main pc (PC1), and then I download a video from PC2 (another that is in the same LAN that PC1), this video is downloaded in PC1s downloads folder. This is part of my code:

    const express = require('express');
const router = express.Router(); //EL ENCARGADO DE CREAR LAS RUTAS
//const downloadsFolder = require('downloads-folder');
const path = require('path');
const fs = require('fs')
const ytdl = require('ytdl-core');

router.post('/video-url-upload', async (req, res)=>{
    var downloadFolder = path.join(process.env.USERPROFILE, "/Downloads/");
    console.log(downloadFolder);
    //console.log(downloadsFolder());
 
    const url = req.body.urlsubida;
    
    let nombre = await (await ytdl.getInfo(url)).videoDetails.title;
    const nombre_archivo = nombre + '.mp4';
    console.log(nombre_archivo);
    ytdl(url).pipe(fs.createWriteStream(downloadFolder + nombre_archivo));

    res.send('video.mp4');
})

module.exports = router;

I want the video storage in PC2 downloads folder, but i don't know how I can do it.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source