Online Interview Questions

Prepare interviews on Anything, AnyWhere

PHPSCOTS,Blogger, Developer Views: 1342
Uploading image from url using Node js

Simple function In Node.js to save image from URL to local disk/ server

Here we are going to see how to Upload an image from url in Node js.Whenever we use login with facebook,google or any other social media in node js app, we get some basic information like name, email and profile picture from there. In this post i will show you how to save google, facebook profile picture to server with node.js

var fs = require('fs');
var https = require('https');
//Node.js Function to save image from External URL.
function saveImageToDisk(url, localPath) {var fullUrl = url;
var file = fs.createWriteStream(localPath);
var request = https.get(url, function(response) {



exports.saveImage(req, res) {

let image_path='./uploads/profile/''.jpg';