You may not need an answer, but for others:
My approach was this:
- Make a request by installing
responseTypeand responseEncodingas shown below
const response = await axios.request({
method: 'GET',
url: 'https://www.example.com',
responseType: 'arraybuffer',
responseEncoding: 'binary'
});
- Decode
reponse.datato the desired format
let html = iso88592.decode(response.data.toString('binary'));
Note: in my case, I needed to decode it using this package.
Hope it helps.
source
share