我想创建一个弹出下载链接,目前正在直接在我的计算机上下载它,但是我想创建一个弹出链接,以便当我单击“确定”时它将开始下载。
var video = youtubedl('https://www.youtube.com/watch?v=dPI-mRFEIH0',
// Optional arguments passed to youtube-dl.
['--format=18'],
// Additional options can be given for calling `child_process.execFile()`.
{ cwd: __dirname });
// Will be called when the download starts.
video.on('info', function(info) {
console.log('Download started');
console.log('filename: ' + info._filename);
console.log('size: ' + info.size);
video.pipe(fs.createWriteStream(info._filename));