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
?
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.