Comparing version 3.4.0 to 4.0.0
@@ -214,3 +214,3 @@ 'use strict'; | ||
if (depth <= 8) { | ||
pxData = new Buffer(width * height * 4); | ||
pxData = Buffer.alloc(width * height * 4); | ||
} | ||
@@ -217,0 +217,0 @@ else { |
@@ -33,3 +33,3 @@ 'use strict'; | ||
} | ||
var outData = new Buffer(width * height * outBpp); | ||
var outData = Buffer.alloc(width * height * outBpp); | ||
@@ -36,0 +36,0 @@ var inIndex = 0; |
@@ -55,3 +55,3 @@ 'use strict'; | ||
else { | ||
dataBuffer = new Buffer(data, encoding || this._encoding); | ||
dataBuffer = Buffer.from(data, encoding || this._encoding); | ||
} | ||
@@ -151,3 +151,3 @@ | ||
var count = 0; | ||
var data = new Buffer(read.length); | ||
var data = Buffer.alloc(read.length); | ||
@@ -154,0 +154,0 @@ // create buffer for all data |
@@ -164,3 +164,3 @@ 'use strict'; | ||
var pxPos = 0; | ||
var rawData = new Buffer((byteWidth + 1) * height); | ||
var rawData = Buffer.alloc((byteWidth + 1) * height); | ||
@@ -167,0 +167,0 @@ var sel = filterTypes[0]; |
@@ -131,3 +131,3 @@ 'use strict'; | ||
unfilteredLine = new Buffer(byteWidth); | ||
unfilteredLine = Buffer.alloc(byteWidth); | ||
@@ -134,0 +134,0 @@ switch (filter) { |
@@ -83,3 +83,3 @@ 'use strict'; | ||
if (depth === 16) { | ||
outdata = new Buffer(width * height * 4); | ||
outdata = Buffer.alloc(width * height * 4); | ||
} | ||
@@ -86,0 +86,0 @@ scaleDepth(indata, outdata, width, height, depth); |
@@ -23,3 +23,3 @@ 'use strict'; | ||
// Signature | ||
this.emit('data', new Buffer(constants.PNG_SIGNATURE)); | ||
this.emit('data', Buffer.from(constants.PNG_SIGNATURE)); | ||
this.emit('data', this._packer.packIHDR(width, height)); | ||
@@ -26,0 +26,0 @@ |
@@ -24,3 +24,3 @@ 'use strict'; | ||
// Signature | ||
chunks.push(new Buffer(constants.PNG_SIGNATURE)); | ||
chunks.push(Buffer.from(constants.PNG_SIGNATURE)); | ||
@@ -27,0 +27,0 @@ // Header |
@@ -68,3 +68,3 @@ 'use strict'; | ||
var len = (data ? data.length : 0); | ||
var buf = new Buffer(len + 12); | ||
var buf = Buffer.alloc(len + 12); | ||
@@ -83,3 +83,3 @@ buf.writeUInt32BE(len, 0); | ||
Packer.prototype.packGAMA = function(gamma) { | ||
var buf = new Buffer(4); | ||
var buf = Buffer.alloc(4); | ||
buf.writeUInt32BE(Math.floor(gamma * constants.GAMMA_DIVISION), 0); | ||
@@ -91,3 +91,3 @@ return this._packChunk(constants.TYPE_gAMA, buf); | ||
var buf = new Buffer(13); | ||
var buf = Buffer.alloc(13); | ||
buf.writeUInt32BE(width, 0); | ||
@@ -94,0 +94,0 @@ buf.writeUInt32BE(height, 4); |
@@ -143,3 +143,2 @@ 'use strict'; | ||
} | ||
this.destroySoon(); | ||
}; | ||
@@ -146,0 +145,0 @@ |
@@ -85,3 +85,3 @@ 'use strict'; | ||
this._crc = new CrcCalculator(); | ||
this._crc.write(new Buffer(name)); | ||
this._crc.write(Buffer.from(name)); | ||
@@ -88,0 +88,0 @@ if (this._chunks[type]) { |
@@ -20,3 +20,3 @@ 'use strict'; | ||
this.data = this.width > 0 && this.height > 0 ? | ||
new Buffer(4 * this.width * this.height) : null; | ||
Buffer.alloc(4 * this.width * this.height) : null; | ||
@@ -23,0 +23,0 @@ if (options.fill && this.data) { |
{ | ||
"name": "pngjs", | ||
"version": "3.4.0", | ||
"version": "4.0.0", | ||
"description": "PNG encoder/decoder in pure JS, supporting any bit size & interlace, async & sync with full test suite.", | ||
@@ -33,3 +33,3 @@ "contributors": [ | ||
"engines": { | ||
"node": ">=4.0.0" | ||
"node": ">=8.0.0" | ||
}, | ||
@@ -64,5 +64,5 @@ "main": "./lib/png.js", | ||
"connect": "^3.4.0", | ||
"eslint": "^4.1.0", | ||
"eslint": "^5.15.2", | ||
"istanbul": "^0.4.4", | ||
"phantomjs-prebuilt": "^2.1.7", | ||
"puppeteer": "1.20.0", | ||
"serve-static": "^1.10.0", | ||
@@ -69,0 +69,0 @@ "tap-dot": "^2.0.0", |
@@ -294,2 +294,8 @@ [![Build Status](https://travis-ci.org/lukeapage/pngjs.svg?branch=master)](https://travis-ci.org/lukeapage/pngjs) [![Build status](https://ci.appveyor.com/api/projects/status/tb8418jql1trkntd/branch/master?svg=true)](https://ci.appveyor.com/project/lukeapage/pngjs2/branch/master) [![Coverage Status](https://coveralls.io/repos/lukeapage/pngjs2/badge.svg?branch=master&service=github)](https://coveralls.io/github/lukeapage/pngjs2?branch=master) [![npm version](https://badge.fury.io/js/pngjs.svg)](http://badge.fury.io/js/pngjs) | ||
### 4.0.0 - 09/04/2020 | ||
- Fix issue in newer nodes with using Buffer | ||
- Fix async issue with some png files | ||
- Drop support for Node 4 & 6 | ||
### 3.4.0 - 09/03/2019 | ||
@@ -296,0 +302,0 @@ |
Sorry, the diff of this file is too big to display
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
15535
404
0
554718
27