-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node v9.x.x compatibility #95
Comments
@lukeapage could you or another maintainer advice on this one? |
I wish I had searched the issues before trying to track down this myself 😂 Just arrived at the same line, the call to I experimented with trying to use the builtin Removing the custom update: Interestingly, the following patch works fine on Node.js 6.x. So it seems like my problem in diff --git a/lib/parser-sync.js b/lib/parser-sync.js
index a49e386..342becf 100644
--- a/lib/parser-sync.js
+++ b/lib/parser-sync.js
@@ -67,14 +67,7 @@ module.exports = function(buffer, options) {
var inflateData = Buffer.concat(inflateDataList);
inflateDataList.length = 0;
- var inflatedData;
- if (metaData.interlace) {
- inflatedData = zlib.inflateSync(inflateData);
- } else {
- var rowSize = ((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1;
- var imageSize = rowSize * metaData.height;
- inflatedData = inflateSync(inflateData, { chunkSize: imageSize, maxLength: imageSize });
- }
+ var inflatedData = zlib.inflateSync(inflateData);
inflateData = null;
if (!inflatedData || !inflatedData.length) { |
A PR was merged for this, so it's just waiting on a release. |
Actually the Pr is published when it was merged as 3.3.2... |
Got it! I was looking at the Github releases page, not npm. |
pngjs now works with Node 9. This updates the minimum dependency. pngjs/pngjs#95 (comment) pngjs/pngjs#102
I tried updating to pngjs Clone this repositiory.
Rewrite the test command of package.json to make it easier to understand.
Run the test.
|
@lukeapage - The issue was not fixed in v3.3.2, can you plz take a look? |
This module seems not to be compatible with Node versions >= 9.
Executing
npm run test
with node version 9.2.0 results in various errors:(Part of
npm run test
)For me they seem to be related to nodejs/node#13322 and therefore with this commit: nodejs/node@add4b0a
There the interface used in
lib/sync-inflate.js
changes, therefore the first line failing is line 106 (on current master).https://github.com/lukeapage/pngjs/blob/a3d9c92eec53de0fa3e522f43a7b4fb62831f3b0/lib/sync-inflate.js#L106
By changing line 110 and 111 to use the new internal variable names it is at least possible to circumvent the program exception (by breaking backward compatibility). But then there are several other errors which are not as easy to fix (as far as I have seen).
I'm not sure how to fix this issue by maintaining backward compatibility because there does not seem to exists an "easy" fix to support the new interface. I'm also not sure whether it is necessary to work with the internal state of zlib and not using the official API (which did not change I believe).
Probably someone of the project maintainers could take a look into it or could just shortly write how they plan to make the module ready for Node 9. Probably I am just overlooking something.
The text was updated successfully, but these errors were encountered: