miyucy / brotli

MIT License
59 stars 14 forks source link

JRuby support #45

Open headius opened 1 year ago

headius commented 1 year ago

This library came up while working with a JRuby user on migrating, because they are using it via rack-brotli. I believe we could add support for Brotli compression using an existing JVM library pretty easily. Could we try to work together to get this in and merged for the gem, so we are not stopped by the native extension?

miyucy commented 1 year ago

I apologize for the delayed response. Of course, I would be happy to help. I have no knowledge of Java. Where should I start?

headius commented 4 months ago

Wow I totally missed your response too! I have found a JVM library that is actively developed and would be easy to wrap:

https://github.com/hyperxpro/Brotli4j

The code in this gem would require no Java at all for a first go, since we can simply call out to the library directly! I believe it ships with a Java wrapper around the native library.

An alternative approach would be to just build the Brotli library and bind it with FFI. I think the functions would be simple enough to bind, and the FFI code would work on both CRuby and JRuby.

Are you still available to help? I could take a stab at a simple PR.

miyucy commented 4 months ago

Are you still available to help? I could take a stab at a simple PR.

@headius Thank you for reply. Would it be possible for you to create a pull request?

headius commented 3 months ago

I'm working on it now! I'll try to have something to you by next week.

headius commented 2 months ago

I got sidetracked but I think I can implement the entire thing in Ruby calling out to the existing brotli library. That should make it simple to maintain.