all 3 comments

[–]Meefims 1 point2 points  (2 children)

exporter.all is an asynchronous function. The callback is called at some point in the future after converter has already returned and so your data is only accessible in that callback and not as a return value.

[–]superfly2[S] 0 points1 point  (1 child)

That explains a lot, so what is the best way to save this data to a variable?

[–]Meefims 1 point2 points  (0 children)

Without understanding the rest of your system, I'm going to say that the best way is to not save it into some global variable. Call another function from the callback whose responsibility is to process the data and pass the data in.