How to write in another nodejs project root folder from my npm module

I am writing a npm module that needs to write/create a file in the root folder or in a specific folder in the nodejs project that is going to use my npm module (basically the people who will use my npm module).

this code will create or apend in the logsFile.log in the root directory of the project. If it is imported via npm it will write also in the project that uses that module and not in the node_modules project folder.

So that resolves my question.

Email codedump link for How to write in another nodejs project root folder from my npm module