Meteor.rootPath
Get the path to currently running instance of Meteor application on a server.
Features:
- 🤓 Compatibility with Windows, Linux, and MacOS environments;
- 👨💻 Globally available
Meteor.rootPath— absolute path toprograms/serverdirectory; - 👨💻 Globally available
Meteor.absolutePath— absolute path to.meteordirectory.

Installation
meteor add ostrio:meteor-root
Usage
1const pathToFile = `${Meteor.rootPath}/directory/where/is/your/file.json`;
Returns absolute path to programs/server directory of your compiled application, without trailing slash.
1const pathToFile = `${Meteor.absolutePath}/.meteor/local/build/programs/server/directory/where/is/your/file.json`;
Returns absolute path to .meteor directory of your compiled application, without trailing slash.
Note: Be aware of the path stored in Meteor.absolutePath, it points to the location where Meteor application is running. It isn't guaranteed to be the same path as the path of your project. For example, running Meteor in test-mode will return a path from a temporary location where it's running.
Special thanks
- Thanks to @Konard for testing and maintaining Windows support.
Testing
- Clone this package
- In Terminal (Console) go to directory where package is cloned
- Then run:
# Default meteor test-packages ./ # With custom port meteor test-packages ./ --port 8888 # With local MongoDB and custom port MONGO_URL="mongodb://127.0.0.1:27017/meteor-root-test" meteor test-packages ./ --port 8888
Support this project:
- Star on GitHub
- Star on Atmosphere
- Sponsor maintainer via GitHub — support open source with one-time contribution or on a regular basis
- Sponsor veliovgroup via GitHub — support company behind this package
- Support via PayPal — support our open source contributions
- Use ostr.io — Monitoring, Analytics, WebSec, Web-CRON and Pre-rendering for a website