Giter Site home page Giter Site logo

Zlib partial flush about compression HOT 6 CLOSED

expressjs avatar expressjs commented on April 26, 2024
Zlib partial flush

from compression.

Comments (6)

dougwilson avatar dougwilson commented on April 26, 2024

No, as Z_PARTIAL_FLUSH is dangerous and is infact deprecated in zlib. It only exists because some protocols need it (SSH). It also really hurts your compression ratio.

from compression.

dougwilson avatar dougwilson commented on April 26, 2024

Though if you can point me to research done on this and what the exact effects are on the underlying byte stream, compression, etc., please let me know and we can reconsider.

from compression.

dougwilson avatar dougwilson commented on April 26, 2024

I don't think this flush method is interoperable with all browsers, either (especially older browsers).

from compression.

jakearchibald avatar jakearchibald commented on April 26, 2024

Looks like it was undeprecated back in 2009 http://www.zlib.net/ChangeLog.txt

I'm using it on https://wiki-offline.jakearchibald.com/wiki/Hulk_Hogan?use-url-flags&avoid-wikipedia=1&prevent-sw=1, and not seeing any change in the gzipped size without it. However, I am no zlib expert.

Kinda worried now, what are the dangers you mentioned?

from compression.

dougwilson avatar dougwilson commented on April 26, 2024

So the main thing I saw last time I looked into this was various clients not accepting this kind of flush (the actual streams bytes are different) as well as it doesn't actually flush when you want it to. I see you are trying to flush right after the head and before the body. Using this instead of calling res.flush means it may not flush at the right spot and you won't get exactly what you're looking to get out of this.

If your concern is only modern web browsers and don't care about non web browser clients, then if this flush seems to be working for you, you can certainly use it :)

from compression.

jakearchibald avatar jakearchibald commented on April 26, 2024

I can't find anything on the browser support, but yeah I'm only targeting modern browsers here.

Yeah, the intention is to flush for the header, but additional flushing is welcome. res.flush was working for me, but required a lot of hackery to make it work with dust (a streaming templating language), although I realise that's not this projects problem.

Thanks for the help!

from compression.

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.