Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions imageDownloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const https = require('https');
* @param {*} url url of the image to be downloaded
* @param {*} path path where the image is be saved.
*/
function saveImageToDisk( url, path ){
function saveImageToDisk( { url, path } ){
var fullUrl = url;
var localPath = fs.createWriteStream(path);
try{
Expand All @@ -18,5 +18,4 @@ function saveImageToDisk( url, path ){
}
};

saveImageToDisk('https://random.dog/vh7i79y2qhhy.jpg',
'./image.jpg');
saveImageToDisk( { url: 'https://random.dog/vh7i79y2qhhy.jpg', path: './image.jpg' } );