1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-21 04:52:26 -05:00

Compare commits

...

3 commits

Author SHA1 Message Date
Philipp Claßen
5300923828
Merge 09576d7ddc into e4a16e91fa 2025-01-20 07:03:49 +01:00
ryu
e4a16e91fa
docs(readme): update redirected links (#27726) 2025-01-20 03:01:25 +00:00
Philipp Claßen
09576d7ddc fix: Improve brotliDecompress.
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"
    })();
2024-12-13 19:20:34 +01:00
3 changed files with 16 additions and 5 deletions

View file

@ -6,8 +6,8 @@
<img align="right" src="https://deno.land/logo.svg" height="150px" alt="the deno mascot dinosaur standing in the rain">
[Deno](https://www.deno.com)
([/ˈdiːnoʊ/](http://ipa-reader.xyz/?text=%CB%88di%CB%90no%CA%8A), pronounced
[Deno](https://deno.com)
([/ˈdiːnoʊ/](https://ipa-reader.com/?text=%CB%88di%CB%90no%CA%8A), pronounced
`dee-no`) is a JavaScript, TypeScript, and WebAssembly runtime with secure
defaults and a great developer experience. It's built on [V8](https://v8.dev/),
[Rust](https://www.rust-lang.org/), and [Tokio](https://tokio.rs/).

View file

@ -204,8 +204,19 @@ export function brotliCompressSync(
return Buffer.from(TypedArrayPrototypeSubarray(output, 0, len));
}
export function brotliDecompress(input) {
export function brotliDecompress(
input,
options,
callback,
) {
const buf = toU8(input);
if (typeof options === "function") {
callback = options;
options = {};
}
// note: `options` argument is currently not used
return PromisePrototypeCatch(
PromisePrototypeThen(
op_brotli_decompress_async(buf),

View file

@ -48,8 +48,8 @@ const packages: Package[] = [{
const markdownText = `# Deno
[Deno](https://www.deno.com)
([/ˈdiːnoʊ/](http://ipa-reader.xyz/?text=%CB%88di%CB%90no%CA%8A), pronounced
[Deno](https://deno.com)
([/ˈdiːnoʊ/](https://ipa-reader.com/?text=%CB%88di%CB%90no%CA%8A), pronounced
\`dee-no\`) is a JavaScript, TypeScript, and WebAssembly runtime with secure
defaults and a great developer experience. It's built on [V8](https://v8.dev/),
[Rust](https://www.rust-lang.org/), and [Tokio](https://tokio.rs/).