How do modern browsers deflate .tar.gz files?












1















Assuming the server is set up correctly, modern browsers are able to automatically decompress .gzip files when they are downloaded. Is the same true for a .tar.gz file?



For example, say you have an HTML5 game with a lot of assets. It would make sense to compress the assets (game models, sound, etc.) into a single .tar file, and then (I assume) compress it again into a .gzip file. Will anything special need to be done on the client side to unpack them? Or is there a better approach to compressing assets on the server, making my question as-is sort of moot?










share|improve this question























  • Is this programming related? Maybe stackoverflow would be better. Or if web servers then serverfault.

    – Xen2050
    Jan 31 at 11:33











  • @Xen2050 Yeah I wasn't too sure which site to ask it on. I'm not looking for a coding solution, I'm just trying to understand if I'll need to come up with a coding solution. But I first am just wondering if I can store assets on the server in a single compressed .tar.gz folder.

    – sme
    Jan 31 at 11:38











  • Did you try it? What happens?

    – Xen2050
    Jan 31 at 12:08











  • Not yet; I don't have access my server at the moment

    – sme
    Jan 31 at 12:15
















1















Assuming the server is set up correctly, modern browsers are able to automatically decompress .gzip files when they are downloaded. Is the same true for a .tar.gz file?



For example, say you have an HTML5 game with a lot of assets. It would make sense to compress the assets (game models, sound, etc.) into a single .tar file, and then (I assume) compress it again into a .gzip file. Will anything special need to be done on the client side to unpack them? Or is there a better approach to compressing assets on the server, making my question as-is sort of moot?










share|improve this question























  • Is this programming related? Maybe stackoverflow would be better. Or if web servers then serverfault.

    – Xen2050
    Jan 31 at 11:33











  • @Xen2050 Yeah I wasn't too sure which site to ask it on. I'm not looking for a coding solution, I'm just trying to understand if I'll need to come up with a coding solution. But I first am just wondering if I can store assets on the server in a single compressed .tar.gz folder.

    – sme
    Jan 31 at 11:38











  • Did you try it? What happens?

    – Xen2050
    Jan 31 at 12:08











  • Not yet; I don't have access my server at the moment

    – sme
    Jan 31 at 12:15














1












1








1








Assuming the server is set up correctly, modern browsers are able to automatically decompress .gzip files when they are downloaded. Is the same true for a .tar.gz file?



For example, say you have an HTML5 game with a lot of assets. It would make sense to compress the assets (game models, sound, etc.) into a single .tar file, and then (I assume) compress it again into a .gzip file. Will anything special need to be done on the client side to unpack them? Or is there a better approach to compressing assets on the server, making my question as-is sort of moot?










share|improve this question














Assuming the server is set up correctly, modern browsers are able to automatically decompress .gzip files when they are downloaded. Is the same true for a .tar.gz file?



For example, say you have an HTML5 game with a lot of assets. It would make sense to compress the assets (game models, sound, etc.) into a single .tar file, and then (I assume) compress it again into a .gzip file. Will anything special need to be done on the client side to unpack them? Or is there a better approach to compressing assets on the server, making my question as-is sort of moot?







compression tar gzip






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 31 at 11:29









smesme

1135




1135













  • Is this programming related? Maybe stackoverflow would be better. Or if web servers then serverfault.

    – Xen2050
    Jan 31 at 11:33











  • @Xen2050 Yeah I wasn't too sure which site to ask it on. I'm not looking for a coding solution, I'm just trying to understand if I'll need to come up with a coding solution. But I first am just wondering if I can store assets on the server in a single compressed .tar.gz folder.

    – sme
    Jan 31 at 11:38











  • Did you try it? What happens?

    – Xen2050
    Jan 31 at 12:08











  • Not yet; I don't have access my server at the moment

    – sme
    Jan 31 at 12:15



















  • Is this programming related? Maybe stackoverflow would be better. Or if web servers then serverfault.

    – Xen2050
    Jan 31 at 11:33











  • @Xen2050 Yeah I wasn't too sure which site to ask it on. I'm not looking for a coding solution, I'm just trying to understand if I'll need to come up with a coding solution. But I first am just wondering if I can store assets on the server in a single compressed .tar.gz folder.

    – sme
    Jan 31 at 11:38











  • Did you try it? What happens?

    – Xen2050
    Jan 31 at 12:08











  • Not yet; I don't have access my server at the moment

    – sme
    Jan 31 at 12:15

















Is this programming related? Maybe stackoverflow would be better. Or if web servers then serverfault.

– Xen2050
Jan 31 at 11:33





Is this programming related? Maybe stackoverflow would be better. Or if web servers then serverfault.

– Xen2050
Jan 31 at 11:33













@Xen2050 Yeah I wasn't too sure which site to ask it on. I'm not looking for a coding solution, I'm just trying to understand if I'll need to come up with a coding solution. But I first am just wondering if I can store assets on the server in a single compressed .tar.gz folder.

– sme
Jan 31 at 11:38





@Xen2050 Yeah I wasn't too sure which site to ask it on. I'm not looking for a coding solution, I'm just trying to understand if I'll need to come up with a coding solution. But I first am just wondering if I can store assets on the server in a single compressed .tar.gz folder.

– sme
Jan 31 at 11:38













Did you try it? What happens?

– Xen2050
Jan 31 at 12:08





Did you try it? What happens?

– Xen2050
Jan 31 at 12:08













Not yet; I don't have access my server at the moment

– sme
Jan 31 at 12:15





Not yet; I don't have access my server at the moment

– sme
Jan 31 at 12:15










1 Answer
1






active

oldest

votes


















2














The short answer is, the browser doesn't.



Most web servers can transparently gzip the data being sent to your browser to save on transmission time, but gzip is just a compression algorithm. tar, on the other hand, is a format used for batching files together into a single archive.



The longer answer is that it's the interplay between two different HTTP headers: Content-Encoding and Content-Type.



When you hit a webpage that uses gzip, you're receiving a Content-Type of text/html with a Content-Encoding of gzip. The browser knows how to handle text/html, and so it transparently uncompresses the response and renders it on your screen.



When you download a .gz or a tar file, you're receiving something with a Content-Type of application/x-gzip (or x-tar or x-tar-gz), which prompts the browser to treat the data as a file download, rather than trying to do anything with it on its own.



There's no such thing as a Content-Encoding of tar, since that header is only ever used to advertise a type of compression - so sending a .tar.gz file to a browser with gzip encoding would be pointless and wasteful. The data is already compressed.






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1400511%2fhow-do-modern-browsers-deflate-tar-gz-files%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    The short answer is, the browser doesn't.



    Most web servers can transparently gzip the data being sent to your browser to save on transmission time, but gzip is just a compression algorithm. tar, on the other hand, is a format used for batching files together into a single archive.



    The longer answer is that it's the interplay between two different HTTP headers: Content-Encoding and Content-Type.



    When you hit a webpage that uses gzip, you're receiving a Content-Type of text/html with a Content-Encoding of gzip. The browser knows how to handle text/html, and so it transparently uncompresses the response and renders it on your screen.



    When you download a .gz or a tar file, you're receiving something with a Content-Type of application/x-gzip (or x-tar or x-tar-gz), which prompts the browser to treat the data as a file download, rather than trying to do anything with it on its own.



    There's no such thing as a Content-Encoding of tar, since that header is only ever used to advertise a type of compression - so sending a .tar.gz file to a browser with gzip encoding would be pointless and wasteful. The data is already compressed.






    share|improve this answer






























      2














      The short answer is, the browser doesn't.



      Most web servers can transparently gzip the data being sent to your browser to save on transmission time, but gzip is just a compression algorithm. tar, on the other hand, is a format used for batching files together into a single archive.



      The longer answer is that it's the interplay between two different HTTP headers: Content-Encoding and Content-Type.



      When you hit a webpage that uses gzip, you're receiving a Content-Type of text/html with a Content-Encoding of gzip. The browser knows how to handle text/html, and so it transparently uncompresses the response and renders it on your screen.



      When you download a .gz or a tar file, you're receiving something with a Content-Type of application/x-gzip (or x-tar or x-tar-gz), which prompts the browser to treat the data as a file download, rather than trying to do anything with it on its own.



      There's no such thing as a Content-Encoding of tar, since that header is only ever used to advertise a type of compression - so sending a .tar.gz file to a browser with gzip encoding would be pointless and wasteful. The data is already compressed.






      share|improve this answer




























        2












        2








        2







        The short answer is, the browser doesn't.



        Most web servers can transparently gzip the data being sent to your browser to save on transmission time, but gzip is just a compression algorithm. tar, on the other hand, is a format used for batching files together into a single archive.



        The longer answer is that it's the interplay between two different HTTP headers: Content-Encoding and Content-Type.



        When you hit a webpage that uses gzip, you're receiving a Content-Type of text/html with a Content-Encoding of gzip. The browser knows how to handle text/html, and so it transparently uncompresses the response and renders it on your screen.



        When you download a .gz or a tar file, you're receiving something with a Content-Type of application/x-gzip (or x-tar or x-tar-gz), which prompts the browser to treat the data as a file download, rather than trying to do anything with it on its own.



        There's no such thing as a Content-Encoding of tar, since that header is only ever used to advertise a type of compression - so sending a .tar.gz file to a browser with gzip encoding would be pointless and wasteful. The data is already compressed.






        share|improve this answer















        The short answer is, the browser doesn't.



        Most web servers can transparently gzip the data being sent to your browser to save on transmission time, but gzip is just a compression algorithm. tar, on the other hand, is a format used for batching files together into a single archive.



        The longer answer is that it's the interplay between two different HTTP headers: Content-Encoding and Content-Type.



        When you hit a webpage that uses gzip, you're receiving a Content-Type of text/html with a Content-Encoding of gzip. The browser knows how to handle text/html, and so it transparently uncompresses the response and renders it on your screen.



        When you download a .gz or a tar file, you're receiving something with a Content-Type of application/x-gzip (or x-tar or x-tar-gz), which prompts the browser to treat the data as a file download, rather than trying to do anything with it on its own.



        There's no such thing as a Content-Encoding of tar, since that header is only ever used to advertise a type of compression - so sending a .tar.gz file to a browser with gzip encoding would be pointless and wasteful. The data is already compressed.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 14 at 19:45

























        answered Feb 14 at 19:35









        Mikey T.K.Mikey T.K.

        2,17931840




        2,17931840






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1400511%2fhow-do-modern-browsers-deflate-tar-gz-files%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to make a Squid Proxy server?

            第一次世界大戦

            Touch on Surface Book