Comparing version 2.1.1 to 2.2.0
@@ -48,3 +48,7 @@ /** Constant used in PNG encoding methods. */ | ||
export interface DecodeOptions { | ||
premultipled: boolean; | ||
} | ||
export function encodePNG(width: number, height: number, data: Buffer, options?: PngConfig): Promise<Buffer>; | ||
export function decodePNG(data: Buffer): Promise<DecodedImageData>; | ||
export function decodePNG(data: Buffer, options?: DecodeOptions): Promise<DecodedImageData>; |
@@ -23,9 +23,10 @@ const bindings = require('./build/Release/ag_images.node'); | ||
exports.decodePNG = function (buffer) { | ||
exports.decodePNG = function (buffer, options) { | ||
return new Promise((resolve, reject) => { | ||
bindings.decodePNG(buffer, (error, data, width, height) => { | ||
const premultiplied = options?.premultiplied || false; | ||
bindings.decodePNG(buffer, premultiplied, (error, data, width, height) => { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve({ data, width, height }); | ||
resolve({ data, width, height, premultiplied }); | ||
} | ||
@@ -32,0 +33,0 @@ }) |
{ | ||
"name": "ag-images", | ||
"description": "Library for loading and saving PNG files", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"main": "index.js", | ||
@@ -30,4 +30,4 @@ "browser": "browser.js", | ||
"dependencies": { | ||
"@types/node": "^14.11.2", | ||
"nan": "nodejs/nan", | ||
"@types/node": "20.9.4", | ||
"nan": "2.18.0", | ||
"node-pre-gyp": "^0.15.0" | ||
@@ -34,0 +34,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
8802395
601
82
1
4
+ Added@types/node@20.9.4(transitive)
+ Addednan@2.18.0(transitive)
+ Addedundici-types@5.26.5(transitive)
- Removed@types/node@14.18.63(transitive)
Updated@types/node@20.9.4
Updatednan@2.18.0