I need to get the path of the file inside the private folder.
On my local machine I was able to get it by using the path "../../../../../"
, however, when I deployed to meteor server using meteor deploy
, it doesn't work anymore. Also I tried to log the current directory using process.cwd()
and got the following, which is different from the structure I got on my local machine:
/meteor/containers/3906c248-566e-61b7-4637-6fb724a33c16/bundle/programs/server
The directory logged from my local machine gives:
/Users/machineName/Documents/projectName/.meteor/local/build/programs/server
Note: I am using this path to setup https://www.npmjs.com/package/apn
Call Assets.absoluteFilePath(assetPath) on one of the assets in the private folder, then chop of the name of the asset file from the string you get back, e.g., assuming you have a file called test.txt in the private folder:
https://docs.meteor.com/api/assets.html#Assets-absoluteFilePath
You can use
assets/app/
as the relative path. While this may not make sense on the first look Meteor re-arranges your/private
directory to map toassets/app
from the/programs/server
directory. This is both in development and production.Basically assume that
private/
maps toassets/app/
.