使用节点js在另一个文件夹中打开文件 [英] Open file in another folder with node js

查看:95
本文介绍了使用节点js在另一个文件夹中打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用绝对路径使用nodejs打开另一个文件夹上的文件.
此文件包含必须在节点上执行的js程序.
我正在使用约翰尼五号编程Arduino,但是该文件与节点文件和库不在同一个文件夹中.
这怎么办?

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?

推荐答案

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

这将从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?

这篇关于使用节点js在另一个文件夹中打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆