在Meteor Deploy环境中获取Meteor私人文件夹路径 [英] Getting Meteor private folder path in Meteor Deploy Environment
问题描述
我需要在私人文件夹中获取该文件的路径。
在我的本地机器上,我可以使用路径../../../../../
当我使用流星部署
部署到流星服务器时,它不再工作了。另外我试图使用 process.cwd()
记录当前目录,并得到以下内容,这与本地机器上的结构不同:
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
注意:我正在使用此路径设置 https://www.npmjs.com/package/apn
Note: I am using this path to setup https://www.npmjs.com/package/apn
推荐答案
您可以使用 assets / app /
作为相对路径。虽然这可能不是有意义的第一次看Meteor重新安排您的 / private
目录映射到资产/应用程序
来自 / programs / server
目录。这是在开发和生产中。
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 to assets/app
from the /programs/server
directory. This is both in development and production.
基本上假设 private /
映射到资产/ app /
。
这篇关于在Meteor Deploy环境中获取Meteor私人文件夹路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!