midi-json-parser
midi-json-parser copied to clipboard
Error importing module in node.js
trafficstars
Trying to import the module in node.js v17.4.0, I get the following error:
ReferenceError: Blob is not defined
at node_modules/midi-json-parser/build/es5/bundle.js:10:13
at node_modules/midi-json-parser/build/es5/bundle.js:2:65
at Object.<anonymous> (node_modules/midi-json-parser/build/es5/bundle.js:5:3)
Looks like node.js needs additional work to import Blob as per https://stackoverflow.com/questions/14653349/node-js-cant-create-blobs
I'm sorry, but that's expected. The module is meant to only work in the browser. It's because it uses a Web Worker internally for the parsing. We could certainly build a version for Node.js as well. It just didn't happen so far. I guess it should then work with streams instead of an ArrayBuffer.
Yes, thanks for considering a node version.