Coder Social home page Coder Social logo

Gzip support. about serve-static HOT 5 CLOSED

expressjs avatar expressjs commented on May 12, 2024
Gzip support.

from serve-static.

Comments (5)

dougwilson avatar dougwilson commented on May 12, 2024

Add the compression middleware before this middleware (https://github.com/expressjs/compression).

from serve-static.

DylanPiercey avatar DylanPiercey commented on May 12, 2024

@dougwilson thats a fine solution, and my current one. I was under the impression that it was more performant to serve pre gzipped files and thought it would be a good feature for this lib.

from serve-static.

dougwilson avatar dougwilson commented on May 12, 2024

It is never performant to serve static files from Node.js, because all file I/O uses a small thread pool. Many modules currently exist on npm and there is a PR with some initial ideas about adding it here I have not yet looked at enough besides to say it's missing some error handing that will crash the server.

from serve-static.

dougwilson avatar dougwilson commented on May 12, 2024

The module https://github.com/code42day/connect-gzip-static is a good one, and even uses the same core modules this module does.

from serve-static.

eljefedelrodeodeljefe avatar eljefedelrodeodeljefe commented on May 12, 2024

@dougwilson I think this can rather be meant a little differently. E.g. why not caching gzipped buffers after first read, instead of always streaming the file. This would only take some boilerplate with node core libs. The only non-straightforward thing is to not to allow certain clients (like older IE versions) to retrieve gzip data streams, as they can't accept it properly.

The behaviour could be only enabled with an option flag.

This would mitigate the typical node caveat you mentioned by a lot.

I think it's worth having it in the ecosystem.

from serve-static.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.