[Server] Get current path on server, where is Meteor application is running
JavaScript
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.github meta Mar 3, 2018
.gitignore v1.0.0 Apr 12, 2015
.versions v1.0.7 Mar 3, 2018
CHANGELOG.md v1.0.3 Mar 23, 2016
CODE_OF_CONDUCT.md meta Mar 3, 2018
CONTRIBUTING.md meta Mar 3, 2018
HISTORY.md meta Feb 23, 2017
LICENSE Year bump Mar 3, 2018
README.md Fix: #8 , thanks to @SimonSimCity Mar 3, 2018
meteor-root-test.js v1.0.5 Feb 23, 2017
meteor-root.js v1.0.5 Feb 23, 2017
package.js v1.0.7 Mar 3, 2018

README.md

Meteor.rootPath

Get current path on your server, where is Meteor application is running.

This package supports Windows. Thanks to @Konard.

Install:

meteor add ostrio:meteor-root

Usage:

const pathToFile = Meteor.rootPath + '/folder/where/is/your/file.json';

Returns absolute path to programs/server folder of your compiled application, without trailing slash.

const pathToFile = Meteor.absolutePath + '/.meteor/local/build/programs/server/folder/where/is/your/file.json';

Returns absolute path to .meteor folder of your compiled application, without trailing slash.

Note: Be aware of that the path, returned by Meteor.absolutePath returns the location from where your Meteor application is running from. This is not guaranteed to be the same as the path of your project. Running Meteor in test-mode, for example, will return a path from a temporary location it's running.