Open file in another folder with node js

2019-09-19 05: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条回答
贪生不怕死
2楼-- · 2019-09-19 06:02
 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?

查看更多
登录 后发表回答