var url = require('url');
var http = require('http');
var sizeOf = require('image-size');
var imgUrl = 'http://my-amazing-website.com/image.jpeg';
var options = url.parse(imgUrl);
http.get(options, function (response) {
var chunks = [];
response.on('data', function (chunk) {
chunks.push(chunk);
}).on('end', function() {
var buffer = Buffer.concat(chunks);
console.log(sizeOf(buffer));
});
});
Image-size is a third-party library for obtaining image size. With the http module, the image size can be obtained remotely.
Found the solution.
Image-size is a third-party library for obtaining image size. With the http module, the image size can be obtained remotely.