Reading files inside zip files from Javascript

Discussion in 'Javascript' started by Narendra Sisodiya, Dec 7, 2009.

  1. I have some xml files which are zipped. I want to read them using
    Ajax (Javascript). may anybody suggest some way to do so??

    I otherway, Do http protocol support reading or getting files inside a
    zip file?

    Something like
    http://localhost/MySlideshow.odp{/Images/Thumbnail.png}
    ??
    I want to get such files using Ajax. Do we have any possible solution
    at client side where we get one zip file and unzip using Javascript
    and read files ?
     
    Narendra Sisodiya, Dec 7, 2009
    #1
    1. Advertising

  2. Narendra Sisodiya

    rf Guest

    "Narendra Sisodiya" <> wrote in message
    news:...
    >I have some xml files which are zipped. I want to read them using
    > Ajax (Javascript). may anybody suggest some way to do so??
    >
    > I otherway, Do http protocol support reading or getting files inside a
    > zip file?
    >
    > Something like
    > http://localhost/MySlideshow.odp{/Images/Thumbnail.png}
    > ??
    > I want to get such files using Ajax.


    If you are using Ajax then you are calling a server side process. Do it on
    the server. Zip is fully supported by server side things such as PHP.
     
    rf, Dec 7, 2009
    #2
    1. Advertising

  3. Narendra Sisodiya wrote:

    > I have some xml files which are zipped,


    "Zipped" as in "ZIP archive" (of many files)?

    > I want to read them using Ajax (Javascript). may anybody suggest some way
    > to do so??


    Yes.

    > I otherway, Do http protocol support reading or getting files inside a
    > zip file?


    No. HTTP supports transparent gzip compression and decompression, though.

    > Something like
    > http://localhost/MySlideshow.odp{/Images/Thumbnail.png}
    > ??


    Whether that can work does not depend on the transport protocol, but on the
    server side. Certainly the server would need to serve only the image
    resource then.

    > I want to get such files using Ajax.


    Possible, but whether the payload can be put to use would probably depend on
    the user agent supporting `data:' URLs.

    > Do we have any possible solution at client side where we get one zip file
    > and unzip using Javascript and read files ?


    Unlikely.

    <http://jibbering.com/faq/#posting>


    PointedEars
    --
    Anyone who slaps a 'this page is best viewed with Browser X' label on
    a Web page appears to be yearning for the bad old days, before the Web,
    when you had very little chance of reading a document written on another
    computer, another word processor, or another network. -- Tim Berners-Lee
     
    Thomas 'PointedEars' Lahn, Dec 7, 2009
    #3
  4. On Dec 7, 10:54 am, Thomas 'PointedEars' Lahn <>
    wrote:

    > Possible, but whether the payload can be put to use would probably dependon
    > the user agent supporting `data:' URLs.


    I believe most, if not all major browsers offer a means to obtain a
    "binary" string through XmlHttpRequest with or without the use of a
    custom overridemimetype.
     
    Michael Haufe (\TNO\), Dec 7, 2009
    #4
  5. Michael Haufe ("TNO") wrote:

    > Thomas 'PointedEars' Lahn wrote:
    >> Possible, but whether the payload can be put to use would probably depend
    >> on the user agent supporting `data:' URLs.

    >
    > I believe most, if not all major browsers offer a means to obtain a
    > "binary" string through XmlHttpRequest with or without the use of a
    > custom overridemimetype.


    Apparently you have not understood what I said. Of course it is possible to
    obtain the "binary" string (the payload I was talking about). And then what?


    PointedEars
    --
    Danny Goodman's books are out of date and teach practices that are
    positively harmful for cross-browser scripting.
    -- Richard Cornford, cljs, <cife6q$253$1$> (2004)
     
    Thomas 'PointedEars' Lahn, Dec 7, 2009
    #5
  6. On Dec 7, 4:12 pm, Thomas 'PointedEars' Lahn <>
    wrote:

    > Apparently you have not understood what I said.  Of course it is possible to
    > obtain the "binary" string (the payload I was talking about). And then what?


    The format of a ZIP file is documented on the interwebs (http://
    www.pkware.com/documents/casestudies/APPNOTE.TXT).

    If one was so inclined, they could write a decoder to extract the xml
    and pass them to a DOM parser in their string form.
     
    Michael Haufe (\TNO\), Dec 7, 2009
    #6
  7. Michael Haufe ("TNO") wrote:

    > Thomas 'PointedEars' Lahn wrote:
    >> Apparently you have not understood what I said. Of course it is possible
    >> to obtain the "binary" string (the payload I was talking about). And then
    >> what?

    >
    > The format of a ZIP file is documented on the interwebs (http://
    > www.pkware.com/documents/casestudies/APPNOTE.TXT).
    >
    > If one was so inclined, they could write a decoder to extract the xml
    > and pass them to a DOM parser in their string form.


    This part of the question was about PNG image data in a ZIP archive.


    PointedEars
    --
    Prototype.js was written by people who don't know javascript for people
    who don't know javascript. People who don't know javascript are not
    the best source of advice on designing systems that use javascript.
    -- Richard Cornford, cljs, <f806at$ail$1$>
     
    Thomas 'PointedEars' Lahn, Dec 7, 2009
    #7
  8. On Dec 7, 5:33 pm, Thomas 'PointedEars' Lahn <>
    wrote:
    >
    > This part of the question was about PNG image data in a ZIP archive.
    >


    Indeed, I read too hastily. I concede the comment on the XML portion
    and agree with you on the data uri support.
     
    Michael Haufe (\TNO\), Dec 8, 2009
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Hunsley
    Replies:
    1
    Views:
    615
    Andrew Thompson
    Sep 16, 2004
  2. Replies:
    0
    Views:
    1,755
  3. HARI OM
    Replies:
    0
    Views:
    17,455
    HARI OM
    May 3, 2005
  4. MoshiachNow
    Replies:
    2
    Views:
    282
    Ilya Zakharevich
    Oct 4, 2006
  5. Bo Yang
    Replies:
    9
    Views:
    314
    -berlin.de
    Nov 20, 2006
Loading...

Share This Page