im using glob from npm
gl = require("glob");
get = {};
gl("path/to/files/*.rmd", {}, function(err, files){
get.files = files
});
console.log(get.files)
output: undefined
what im trying to do is get access to the files from outside its callback. But, everything I try isn't working.
Use glob.sync which can be used to make a synchronous call
gl = require("glob");
let get = {};
get['files']=gl.sync("path/to/files/*.rmd", {});
console.log(get.files)
Ref: sync call glob.sync