Comparing version 1.1.2 to 2.0.0
10
index.js
'use strict'; | ||
const PNG = require('pngjs').PNG; | ||
const {PNG} = require('pngjs'); | ||
module.exports = (buf, opts) => { | ||
if (!Buffer.isBuffer(buf)) { | ||
return Promise.reject(new TypeError('Expected a buffer')); | ||
module.exports = async (buffer, opts) => { | ||
if (!Buffer.isBuffer(buffer)) { | ||
throw new TypeError(`Expected \`buffer\` to be of type \`Buffer\` but received type \`${typeof buffer}\``); | ||
} | ||
@@ -19,4 +19,4 @@ | ||
png.end(buf); | ||
png.end(buffer); | ||
}); | ||
}; |
{ | ||
"name": "parse-png", | ||
"version": "1.1.2", | ||
"description": "Parse a PNG", | ||
"license": "MIT", | ||
"repository": "kevva/parse-png", | ||
"author": { | ||
"name": "Kevin Martensson", | ||
"email": "kevinmartensson@gmail.com", | ||
"url": "github.com/kevva" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"parse", | ||
"png", | ||
"promise" | ||
], | ||
"dependencies": { | ||
"pngjs": "^3.2.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"file-type": "^4.3.0", | ||
"get-stream": "^3.0.0", | ||
"pify": "^2.3.0", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
"name": "parse-png", | ||
"version": "2.0.0", | ||
"description": "Parse a PNG", | ||
"license": "MIT", | ||
"repository": "kevva/parse-png", | ||
"author": { | ||
"name": "Kevin Martensson", | ||
"email": "kevinmartensson@gmail.com", | ||
"url": "github.com/kevva" | ||
}, | ||
"engines": { | ||
"node": ">=10" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"parse", | ||
"png", | ||
"promise" | ||
], | ||
"dependencies": { | ||
"pngjs": "^3.3.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^2.4.0", | ||
"file-type": "^7.2.0", | ||
"get-stream": "^3.0.0", | ||
"xo": "^0.24.0" | ||
} | ||
} |
@@ -9,3 +9,3 @@ # parse-png [![Build Status](https://travis-ci.org/kevva/parse-png.svg?branch=master)](https://travis-ci.org/kevva/parse-png) | ||
``` | ||
$ npm install --save parse-png | ||
$ npm install parse-png | ||
``` | ||
@@ -20,3 +20,5 @@ | ||
parsePng(fs.readFileSync('unicorn.png')).then(png => { | ||
(async () => { | ||
const png = await parsePng(fs.readFileSync('unicorn.png')); | ||
console.log(png); | ||
@@ -40,3 +42,3 @@ /* | ||
png.pack().pipe(fs.createWriteStream('unicorn-adjusted.png')); | ||
}); | ||
})(); | ||
``` | ||
@@ -47,9 +49,9 @@ | ||
### parsePng(buffer, [options]) | ||
### parsePng(buffer, options?) | ||
Returns a promise for a PNG instance. See the [pngjs documentation](https://github.com/lukeapage/pngjs#async-api) for more information. | ||
Returns a `Promise<Object>` with a PNG instance. See the [pngjs documentation](https://github.com/lukeapage/pngjs#async-api) for more information. | ||
#### buffer | ||
Type: `buffer` | ||
Type: `Buffer` | ||
@@ -60,9 +62,4 @@ A PNG image buffer. | ||
Type: `object` | ||
Type: `Object` | ||
See the [pngjs options](https://github.com/lukeapage/pngjs#options). | ||
## License | ||
MIT © [Kevin Martensson](http://github.com/kevva) |
Sorry, the diff of this file is not supported yet
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
4
3131
61
Updatedpngjs@^3.3.0