0

I have some 3 or 5 a href links in Node js. Whenever I click those links the video will be download.

How can I save the video in our local directory inside D drive or F Drive through Node JS?

Ian
  • 30,182
  • 19
  • 69
  • 107
Bharat J
  • 1
  • 2

1 Answers1

0

To save/ download the videos from the links using nodejs you can use this code

var http = require('http');
var fs = require('fs');

var download = function(url, dest, cb) {
  var file = fs.createWriteStream(dest);
  var request = http.get(url, function(response) {
    response.pipe(file);
    file.on('finish', function() {
      file.close(cb);
    });
  });
}

I found this code here you can get more methods to do this.

Community
  • 1
  • 1
Lav Vishwakarma
  • 1,380
  • 14
  • 22