probe-image-size
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -0,1 +1,8 @@ | ||
1.0.1 / 2015-09-14 | ||
------------------ | ||
- Return image length when possible. | ||
- Support URLs in dev helper script. | ||
1.0.0 / 2015-09-12 | ||
@@ -2,0 +9,0 @@ ------------------ |
@@ -23,3 +23,3 @@ | ||
// prevent "possible EventEmitter memory leak" warnings | ||
stream.setMaxListeners(Infinity); | ||
stream.setMaxListeners(0); | ||
@@ -56,2 +56,12 @@ async.map(parsers, function (parser, next) { | ||
req.abort(); | ||
if (result) { | ||
var length = res.headers['content-length']; | ||
/* eslint-disable eqeqeq */ | ||
if (length == +length) { | ||
result.length = +length; | ||
} | ||
} | ||
callback(err, result); | ||
@@ -58,0 +68,0 @@ }); |
{ | ||
"name": "probe-image-size", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Get image size without full download (JPG, GIF, PNG, WebP, BMP, TIFF, PSD)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -33,3 +33,3 @@ probe-image-size | ||
probe({ url: 'http://example.com/image.jpg', timeout: 5000 }, function (err, result) { | ||
console.log(result); // => { width: xx, height: yy, type: 'jpg', mime: 'image/jpeg' } | ||
console.log(result); // => { width: xx, height: yy, length: zz, type: 'jpg', mime: 'image/jpeg' } | ||
}); | ||
@@ -59,3 +59,4 @@ | ||
- __String__ - URL to fetch | ||
- __Object__ - options for [request](https://github.com/request/request) | ||
- __Object__ - options for [request](https://github.com/request/request), | ||
defaults are `{ timeout: 5000, maxRedirects: 2 }` | ||
- __Stream__ - readable stream | ||
@@ -69,2 +70,3 @@ | ||
height: YY, | ||
length: ZZ, // byte length of the file (if available, HTTP only) | ||
type: ..., // image 'type' (usual file name extention) | ||
@@ -71,0 +73,0 @@ mime: ... // mime type |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16068
424
92