Closed aickin closed 8 years ago
Hmmm... looks to me like iltorb
isn't building on the travis VMs because they don't include a C++ compiler. They are giving the following error:
Starting with io.js 3 and Node.js 4, building native extensions requires C++11-compatible compiler, which seems unavailable on this VM. Please read https://docs.travis-ci.com/user/languages/javascript-with-nodejs#Node.js-v4-(or-io.js-v3)-compiler-requirements.
Please do not add a dependency on a native module. I'm not sure if you ever tried to setup the compiling chain Node.js requires on Windows, but it is not fun. Express has so far had a policy of no native modules for this reason.
I'm not sure if you ever tried to setup the compiling chain Node.js requires on Windows, but it is not fun.
I did confirm that iltorb
has a build running on Windows, but I haven't tried setting up the compile chain on Windows, no. I do not doubt you in the least about the level of fun involved.
a policy of no native modules
There is a pure JavaScript module brotli
, but it (a) hasn't been updated in almost a year and (b) was made with Emscripten, which almost certainly means it doesn't run as fast as gzip, so I don't think it's a viable addition.
Thanks very much for your time and your work on compression
; I'll close this PR and perhaps offer this code in a separate npm module.
Thanks!
I've been very interested in getting brotli support into the Express world, but the consensus has been that brotli is too slow to be a good runtime compression library. However, a recent article from Akamai indicates that this may be incorrect, and that brotli at quality level 4 gives better compression at slightly faster speeds than gzip's default quality setting of 6, making using brotli a win-win even for dynamic content.
This PR attempts to add brotli support to
compression
, using a default quality of 4 so that the usage of brotli runs fast enough to be competitive with gzip.Given brotli's better compression ratios than gzip, the code in this PR has a strict preference for brotli over gzip or deflate when the client supports it. The PR also maintains the behavior in
master
that prefers gzip over deflate when brotli isn't available.I've added new tests for the cases I could think of, all tests pass, and coverage remains at 100%.
One thing to note is that I added the module
iltorb
, which is not pure JavaScript. It does, however, compile on both UNIX and Windows as far as I can tell. I'm not sure if you are OK with taking dependencies on native modules or not.Thanks for all your hard work, and here's hoping we can see this added!