Hi, I have a meteor app (http://99folks.com) and I’d like to render the current app version in a template, but I didn’t find a way to read data from mobile-config.js file, for while I just repeated the app version into a settings.json, but it is not a good idea keeping two files with the app version. Does anybody can help me?
You can use the npm module fs.
var fs = Npm.require("fs");
var root = process.env.PWD;
fs.readFile(root + '/mobile-config.js', "utf8", function(err, data) {
if (err) throw err;
console.log(data);
});
data
has the content of the file encoded as UTF-8.
1 Like
Thanks a lot! This code works fine!