Skip to content
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

fix: improve brotliDecompress: Uncaught (in promise) ReferenceError: callback is not defined #27358

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

philipp-classen
Copy link

Fixes: Uncaught (in promise) ReferenceError: callback is not defined

Test program that should then pass:

import zlib from 'node:zlib';
import { promisify } from 'node:util';
import { Buffer } from 'node:buffer';
const brotliDecompress = promisify(zlib.brotliDecompress);

(async () => {
  const result = await brotliDecompress(Buffer.from([0x21, 0x0c, 0x00, 0x04, 0x74, 0x65, 0x73, 0x74, 0x03]));
  console.log(result.toString()); // should print "test"
})();

It now matches the signature in https://nodejs.org/api/zlib.html#zlibbrotlidecompressbuffer-options-callback

The implementation is still incomplete, because the options are ignored. But it should still get it closer to the reference implementation (Node.js).

@CLAassistant
Copy link

CLAassistant commented Dec 13, 2024

CLA assistant check
All committers have signed the CLA.

@philipp-classen philipp-classen changed the title Improve brotliDecompress: Uncaught (in promise) ReferenceError: callback is not defined fix: improve brotliDecompress: Uncaught (in promise) ReferenceError: callback is not defined Dec 13, 2024
Fixes: Uncaught (in promise) ReferenceError: callback is not defined

Test program that should then pass:

    import zlib from 'node:zlib';
    import { promisify } from 'node:util';
    import { Buffer } from 'node:buffer';
    const brotliDecompress = promisify(zlib.brotliDecompress);

    (async () => {
      const result = await brotliDecompress(Buffer.from([0x21, 0x0c, 0x00, 0x04, 0x74, 0x65, 0x73, 0x74, 0x03]));
      console.log(result.toString()); // should print "test"
    })();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants