Comments (6)
Just did some reading about brotli, I know now that it's not compatible with gzip :)
So at the moment i could think of two solutions.
- Would be to switch the complete module from gzip to brotli with an options flag and serve just one of the filetypes
- Might be a little more compelling. Where the pre check of the filesystem for .gz files would additionally look for .bz files and serve .bz if browser supporta it and in all other cases or if there is no .bz file availabe would fallback to gzip.
What would be your use case? As i guess the software should best be designed around a use case. Where my initial use case was to serve compressed files on a system where i don't have the resources for live compression and found gzip to fit my needs.
from express-static-gzip.
I'll try to find time in the next days to add this.
While thinking about addind brotli support i was also thinking about adding some modular extendability to the module. So someone could easily add other compression types by simply providing the name the browser would send and a function that would identify the files on the filesystem. But thats not completly thought through at the moment, so i'll start with the brotli support first.
from express-static-gzip.
Hey, as this module does only add specifiy headers and serves files already compressed from the file system, i think it should already be working with brotli, as i remember it should be compatible with gzip!? So it should be enough to pre compress files and point express-static-gzip to the folder containing the .gz files. If brotli has some different extension we could add an additional option to serve brotli files instead of gzip ones.
from express-static-gzip.
I preferred to use both (.gz + .br) with additional option!
such as ensureBrotliedFiles?
from express-static-gzip.
Brotli is now available via options.ensureBrotliFiles.
Could not test it in detail at the moment because i did not had the time to setup a https server. Tested my new architecture with gzip and some other compression (which is now also availabe via options.customCompressions).
Still need to do more testing and add some lines to the readme.
from express-static-gzip.
Module is now updated to 0.2.0 which supports brotli (options.enableBrotli) and custom compressions. How it works is documented in the updated readme.
from express-static-gzip.
Related Issues (20)
- Rename "indexFromEmptyFile" to "index" HOT 4
- single-page router rendering HOT 2
- Checking for compressed versions of a file when requested, rather than at startup will alleviate several potential problems HOT 9
- brotli does not work HOT 12
- Implementation support HOT 19
- silently does not work if the static files folder path contains ".gz" HOT 2
- findAllCompressionFiles errors out if unable to access folder HOT 4
- Header content type always return gzip HOT 2
- Make passing "index" to "serve-static" optional HOT 4
- Change to just middleware? HOT 1
- Can't serve gzip files HOT 6
- Compressed files from nested folders not served HOT 1
- MIME type is 'application/gzip' instead of 'application/javascript' HOT 2
- express static gzip doesnt work in vue ssr HOT 10
- Expose serveStatic.mime HOT 2
- Invalid URI Component in Path HOT 6
- 'maxAge' does not exist in type 'ExpressStaticGzipOptions' HOT 2
- Tries to use .index file when it doesn't exist HOT 1
- Browser preferences takes preference over server HOT 2
- Ensure Https protocol for serving brotli HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from express-static-gzip.