Package Exports
- request-image-size
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (request-image-size) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
request-image-size
This NodeJS module is a clone of http-image-size by Johannes J. Schmidt. It detects image dimensions via request instead of http
/https
, allowing for more flexibility and following redirects by default. Tries image-size on each chunk received until the image dimensions are obtained, and the request is aborted.
Basic usage
var size = require('request-image-size');
size('http://nodejs.org/images/logo.png', function(err, dimensions, length) {
console.log(err, dimensions, length);
});
Advanced usage
Specifying a request options
object (docs):
var size = require('request-image-size');
var options = {
url: 'http://nodejs.org/images/logo.png',
headers: {
'User-Agent': 'request-image-size'
}
};
size(options, function(err, dimensions, length) {
console.log(err, dimensions, length);
});
The callback receives three arguments: err
, dimensions
, length
:
dimensions
is in the form { height: 1063, width: 1600 }
.length
is the number of bytes loaded.
License
Copyright (c) 2014 Rodrigo Fernández Romero Licensed under the MIT license.