midi-parser-js icon indicating copy to clipboard operation
midi-parser-js copied to clipboard

HTMLElement is not defined

Open 360disrupt opened this issue 4 years ago • 1 comments

Node version: v.16.4.2

Code from example `let midiParser = require('midi-parser-js'); let fs = require('fs');

// read a .mid binary (as base64) fs.readFile('./test.mid', 'base64', function (err,data) { // Parse the obtainer base64 string ... var midiArray = midiParser.parse(data); // done! console.log(midiArray); }); `

Error: `midi-parser-js/src/main.js:67 else if(input instanceof HTMLElement && input.type === 'file') return MidiParser.addListener(input , _callback); ^

ReferenceError: HTMLElement is not defined `

Is it an error or will I need additional packages to make this work in nodejs?

360disrupt avatar Dec 13 '21 11:12 360disrupt

I had the same problem and just changed './test.mid' to a midi file I had on my computer.

kinasch avatar Feb 20 '23 21:02 kinasch