I am trying to read in a local sound file and return it using FileReader but FileReader is undefined. Here is my code:
//play a sound
router.get('/sound/:filename', function(req, res, next) {
var reader = new FileReader()
reader.onload = function(e) {
var arrayBuffer = reader.result;
}
reader.readAsArrayBuffer(req.params.filename)
res.send(arrayBuffer)
})
This is inside my api file written purely in Javascript. If I can't use FileReader, is there another way of getting a local file and returning it? Thanks.