Like everyone else is saying, you can use require
and put the function into the exports
:
myOtherFile.js
exports.largeArrayFunction = function() {
//do stuff
return stuff;
}
myMainNodeFile.js
var otherFile = require("myOtherFile.js");
var myArray = otherFile.largeArrayFunction();