I get base64 data as an answer to a POST request.
It's decoded the following way (based on the documentation of the REST API):
let buf = Buffer.from(base64, "base64");
buf = buf.slice(4);
let data = gunzipSync(buf).toString()
console.log(data) // -> {"Code":200,"Value":"8e286fdb-aad2-43c6-87b1-1c6c0d21808a","Route":""}
console.log(data.length) // -> 140 -> Seems weird? Shouldn't it be 70?
Problem:
console.log(JSON.parse(data)) -> SyntaxError: Unexpected token in JSON at position 1
I tried to delete all white characters via replace(/\s/g,''), tried decoding with toString("utf8"), etc. Nothing helps. The only thing that could help is the weird wrong length described above.