[Solved] writeFile to /app/.data/here

Hi, currently, i writeFile using this

const path = "/app/.data/filename.json";
writeFile(path, JSON.stringify(data), (err) => {
  if (err) console.error(err);
});

its working good, but is there any alternative than explicitly using /app/ dir?

Edit :

Well, i found the solution,

const path = require("path");
let dataPath = path.join(__dirname, "../.data/", "some_data.json");