Hi all,
I'm making a function to parse the msg files of outlook because node-red-contrib-mail-parse works only with eml file.
I'm using the module @kenjiuno/msgreader so I installed the module with npm in the node-red folder and I wrote in the settings.js the row msgreader:require('@kenjiuno/msgreader') in functionGlobalContext and I import it in my function node with const MsgReader = global.get('msgreader');
In a normal script this module can be imported with import MsgReader from '@kenjiuno/msgreader' and then it need to create the object with const testMsg = new MsgReader(msgFileBuffer).
In function Node I can't use import so I use const MsgReader = global.get('msgreader'); but the function try the error "TypeError: MsgReader is not a constructor" at the row const testMsg = new MsgReader(msgFileBuffer).
MsgReader is an export of the module @kenjiuno/msgreader so I modified const MsgReader = global.get('msgreader'); in const MsgReader = global.get('msgreader').MsgReader but I have the same error;
I think the problem is that the contruct import-from is not correctly interpreted by the global.get('msgreader') but I didn't understant how I can to translate import MsgReader from '@kenjiuno/msgreader' for node function of nodered.
Can you help me?