What seems like a simple problem turns out to be a bit more complicated.
I have a database that contains the URL of images. I want to create a system that gets the URL and displays the image. After x seconds, download the next image and so on.
What I found: Most dynamic carousels download all images and display them one by one.
Is it even possible to achieve this?
var fs = require('fs'), request = require('request'); var download = function(uri, filename, callback){ request.head(uri, function(err, res, body){ console.log('content-type:', res.headers['content-type']); console.log('content-length:', res.headers['content-length']); request(uri).pipe(fs.createWriteStream(filename)).on('close', callback); }); }; download('https://www.google.com/images/srpr/logo3w.png', 'google.png', function(){ console.log('done'); });