Using third party js libraries with file selection

Hello,

I'm trying to use a third party JavaScript library to read a csv file by selecting a file through an action in Aras, but I'm having trouble getting the selection to work well with the third party library.

In the programmers guide there's an example of how to select a local file:

var vlt = top.aras.vault;
vlt.selectFile().then(function (fileObject)
{
//Some logic
});

and the instrucions for using third party libraries usually looks like this:

require([
    "../javascript/visjs/dist/vis.js",
    "../javascript/underscore-min.js"
], function(
    vis
) {
//Some logic
});

I've tried to get the file object inside the require function like this:

    require([
    "../javascript/papaparse.min.js"
], function(
    Papa
)
{

var fileobject = top.aras.vault.selectFile().then(function (selectedfile)
{
});

});

But the fileobject in this case results in a promise object instead of a file object so I can't use it for my method, and "Papa" doesn't seem to be brought into the second function either. I'm not sure how to get both "Papa" and "fileobject" (as a proper file object) into the same context.

/Rick