Axios downloads pictures across domains

  1. use axios in vue projects to get file streams across domains. No matter how I set responseType, it always returns string

clipboard.png

e

clipboard.png

ask for advice on how to solve the problem

Mar.15,2021

it is useless for you to set it up. If a stream is returned in the background, and you are accessing a file with a physical path, it is not a stream file.


what is the purpose of obtaining a file stream at the front end?


Brother, what you want is the url address of a picture, and then the new Image object loads


to see the header header. It may be that when console is printing, transfer the binary to String, so don't be fooled by the naked eye.


because the project does not remove mockjs and converts the original stream to characters.

Menu