Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

image-size

Package Overview
Dependencies
Maintainers
3
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

image-size - npm Package Compare versions

Comparing version 0.7.5 to 0.8.0

dist/detector.d.ts

25

bin/image-size.js
#!/usr/bin/env node
'use strict';
var fs = require('fs');
var path = require('path');
const fs = require('fs');
const path = require('path');
const { imageSize } = require('..');
var imageSize = require('..');
const files = process.argv.slice(2);
var files = process.argv.slice(2);
if (!files.length) {

@@ -16,6 +15,6 @@ console.error('Usage: image-size image1 [image2] [image3] ...');

var red = ['\x1B[31m', '\x1B[39m'];
// var bold = ['\x1B[1m', '\x1B[22m'];
var grey = ['\x1B[90m', '\x1B[39m'];
var green = ['\x1B[32m', '\x1B[39m'];
const red = ['\x1B[31m', '\x1B[39m'];
// const bold = ['\x1B[1m', '\x1B[22m'];
const grey = ['\x1B[90m', '\x1B[39m'];
const green = ['\x1B[32m', '\x1B[39m'];

@@ -29,7 +28,7 @@ function colorize(text, color) {

if (fs.existsSync(path.resolve(image))) {
var size = imageSize(image);
var greyX = colorize('x', grey);
var greyImage = colorize(image, grey);
let size = imageSize(image);
let greyX = colorize('x', grey);
let greyImage = colorize(image, grey);
(size.images || [size]).forEach(function (size) {
var greyType = '';
let greyType = '';
if (size.type) {

@@ -36,0 +35,0 @@ greyType = colorize(' (' + size.type + ')', grey);

{
"name": "image-size",
"version": "0.7.5",
"version": "0.8.0",
"description": "get dimensions of any image file",
"main": "lib/index.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"bin",
"lib"
"dist",
"bin/image-size.js"
],

@@ -17,5 +18,8 @@ "engines": {

"scripts": {
"pretest": "eslint lib specs",
"pretest": "tslint -p . && tsc && eslint specs",
"test": "nyc mocha specs",
"coverage": "nyc report --reporter=text-lcov | coveralls"
"coverage": "nyc report --reporter=text-lcov | coveralls",
"clean": "rm -rf dist",
"build": "tsc",
"prepack": "npm run clean && npm run build"
},

@@ -45,2 +49,3 @@ "repository": "image-size/image-size",

"devDependencies": {
"@types/node": "12.7.5",
"coveralls": "3.0.6",

@@ -52,4 +57,9 @@ "eslint": "6.4.0",

"nyc": "14.1.1",
"sinon": "7.4.2"
"sinon": "7.4.2",
"tslint": "5.20.0",
"typescript": "3.6.3"
},
"dependencies": {
"queue": "6.0.1"
}
}

@@ -32,3 +32,3 @@ # image-size

```
```shell
npm install image-size --save

@@ -53,5 +53,15 @@ ```

```
NOTE: The asynchronous version doesn't work if the input is a Buffer. Use synchronous version instead.
Also, the asynchronous functions have a default concurreny limit of **100**
To change this limit, you can call the `setConcurrency` function like this:
```javascript
var sizeOf = require('image-size');
sizeOf.setConcurrency(123456)
```
### Using promises (node 8.x)
```javascript

@@ -66,11 +76,14 @@ var { promisify } = require('util');

### Async/Await (Typescript & ES7)
```javascript
var { promisify } = require('util');
var sizeOf = promisify(require('image-size'));
try {
const dimensions = await sizeOf('images/funny-cats.png');
console.log(dimensions.width, dimensions.height);
} catch (err) {
console.error(err);
}
(async () => {
try {
const dimensions = await sizeOf('images/funny-cats.png');
console.log(dimensions.width, dimensions.height);
} catch (err) {
console.error(err);
}
})().then(c => console.log(c));
```

@@ -119,3 +132,3 @@

```
```shell
npm install image-size --global

@@ -122,0 +135,0 @@ image-size image1 [image2] [image3] ...

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc