Open file in another folder with node js

孤街醉人 提交于 2019-12-12 03:47:31

问题


I am trying to open a file on another folder with nodejs using an absolute path.
This file contains a js program that has to be executed the node.
I am using johnny five to program an Arduino but the file is not in the same folder as the node files and the libraries.
How can this be done?


回答1:


 require('C:\\run.js')

This will get 'run.js' file from C disk. But if you already tried this, than please can you explain in more detail what you want to do?



来源:https://stackoverflow.com/questions/37697138/open-file-in-another-folder-with-node-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!