How to Download Image From URL in Node.js Using image-downloader Library Full Tutorial For Beginners 2020

How to Download Image From URL in Node.js Using image-downloader Library Full Tutorial For Beginners 2020

 

Get Started

 

npm i image-downloader

 

 

Download Image From URL

 

 

const imageDownloader = require("image-downloader");

const options = {
  url:
    "https://codingshiksha.com/wp-content/uploads/2020/09/Screenshot_129-310x199.png",
  dest: "./output/photo.jpg",
  // will be saved to /path/to/dest/image.jpg
};

imageDownloader
  .image(options)
  .then(({ filename }) => {
    console.log("file saved" + filename);
  })
  .catch((err) => console.error(err));

Leave a Reply