Skip to content

x/compress/brotli lacks decompress_with_callback #32306

Open

Description

@metif12

The pure-V x/compress/brotli module only exposes compress/decompress, while the native compress.brotli module also exposes decompress_with_callback (used by net/http response decoding for memory-bounded streaming with early-stop).

Switching the import to the pure-V module (e.g. for static builds without system libbrotli) therefore breaks any caller that streams, with unknown function: brotli.decompress_with_callback.

#30904 (the pure-V module) compares only compress/decompress size/speed and never mentions the callback, so this looks like an oversight rather than an intentional carve-out. I searched issues and PRs for decompress_with_callback / x/compress/brotli parity and found nothing covering it (#24904 added the gzip callback before any brotli module existed).

Proposal: add DecompressCallback (same fn ([]u8, voidptr) int shape as the native one, so existing callbacks keep working) and decompress_with_callback(data, cb, userdata) decoding with default DecompressParams and delivering 32 KiB chunks like the native decoder, returning delivered bytes on early stop. I have a PR ready.

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Activity

  1. metif12 commented on Nov 13, 2026

    @metif12
    MemberAuthor

    Context/motivation: vox-browser/vox's Linux production build (unpinned V HEAD, FastC backend) fails with unknown function: brotli.decompress_with_callback when its HTTP compat layer swaps compress.brotli for the pure-V x/compress/brotli (see vox-browser/vox#68, which carries a local same-module shim as a workaround). An upstream decompress_with_callback with the native contract would let that shim go away. PR #32307 implements exactly the contract proposed above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions