Receive zip file, angularJs

后端 未结 2 1392
夕颜
夕颜 2021-01-29 09:17

I\'ve got a problem when I want to download a zip file from a Rest api,

When the zip file is tranfered from my server (with jersey), I receive it corrupted, ...

2条回答
  •  -上瘾入骨i
    2021-01-29 09:41

    I'm downloading zip in the same way ($http / arrayBuffer) and it works.

    I would guess that the problem come from :

    encodeURI(data)
    

    I think you should encode it in base64 (there is tons of exemples out there like https://github.com/niklasvh/base64-arraybuffer/blob/master/lib/base64-arraybuffer.js )

提交回复
热议问题