How to manage responseType = 'blob' using Angular5 in Front end

前端 未结 1 1148
甜味超标
甜味超标 2021-01-29 03:54

I want to download a doc.pdf that have a text \'My first file download\'. When I try to download to zip file, my file have some files.xml Like in this

相关标签:
1条回答
  • 2021-01-29 04:23

    I do not know if this will help you (I'm not so engaged with your tools)

    The file you are downloading is a DOCX format. This is the modern MS-Word format. This format is - even if it has a different extension - a simple ZIP file.

    The PK in the beginning of any zipped file is a magic code, telling consumers what kind of file this is.

    "PK" goes back to "PKWARE" and points to Phil Katz, who was one of those who invented the zip format.

    A zipped file - as any other file - is just a buch of bytes. A consumer has to know, how to read and interpret this.

    You should try to write the byte stream down to a file exactly as you get it, name it "However.docx" and try to open this with MS-Word.

    If this does not help, the byte stream might be compressed, or be somehow encoded itself... At least the picture you show us does not look as such.

    Do not try to take the characters with copy and paste to any kind of editor. Such files have several invisible characters which will get lost... Take the bytes and store them just as you get them (the same you would do to store a JPEG).

    0 讨论(0)
提交回复
热议问题