Closed ChunAllen closed 6 years ago
I'm passing the audio blob file using JavaScript XMLHttpRequest(); here's the my current code where the audio is the blob type audio/wav
var xhr = new XMLHttpRequest(); xhr.open('POST', "/", true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send(audio);
then on my Express JS node, I'm receiving the params using req.body
blobUtil.blobToBase64String(req.body).then(function (base64String) { console.log('success') }).catch(function (err) { console.log('error') });
but I'm getting an error which is ReferenceError: btoa is not defined
Did I missed something here?
This is a library for browsers, and it appears you're using it in Node.js where btoa is unavailable. I suggest looking into Buffers instead: https://nodejs.org/api/buffer.html
btoa
I'm passing the audio blob file using JavaScript XMLHttpRequest(); here's the my current code where the audio is the blob type audio/wav
then on my Express JS node, I'm receiving the params using req.body
but I'm getting an error which is ReferenceError: btoa is not defined
Did I missed something here?