[Axios] FAQ¶
Shift-Jisのデータを扱うことができない¶
responseType: arraybufferを指定してArrayBufferで結果を受け取る。
const sjisStr: ArrayBuffer = await Axios.get("http://localhost:8080/sjis.txt", {
responseType: "arraybuffer",
})
.then((x) => x.data)
これをBuffer.from(arrayBuffer)でBufferに変換し、iconvなどのライブラリでdecodeする。