是否可以使用 Node.js 检索远程文件系统的目录列表。我知道如何使用 readdir(...) 或 readdirSync(...) 在本地执行此操作,但是我可以使用这些方法返回远程文件列表,尤其是来自 http 或 ftp 服务器的远程文件列表吗?
编辑:
我想在 webOS 中执行此操作,因此我似乎仅限于支持的 API。我可能需要执行一些真正的循环方法,例如使用一个脚本来创建一个包含文件夹中文件列表的文件,然后访问该文件。所以我想这会带来第二个问题,我可以从本地脚本触发远程脚本吗?
Is it possible to retrieve a directory listing of a remote file-system using Node.js. I know how to do it locally using readdir(...) or readdirSync(...) but can I use those methods to return a list of remote files especially from a http or ftp server?
EDIT:
I want to do this in webOS so I'm limited to the supported API's it seems. I may have to do some real round-a-bout method like have a script that creates a file that contains a list of files in the folder and just accessing that. So I guess that brings up a second question could I fire a remote script from a local script?
发布评论
评论(2)
您可能需要 jsDav 和 节点 ftp。
You may want jsDav and node-ftp.
当然。您可以为节点找到一个 ftp 客户端,然后如果您的服务器有一个 ftp 服务器,您就可以与其交互。
以下是您如何获得对远程服务器的真正文件系统访问权限
如果您对尝试与之交互的远程计算机具有 root 访问权限,那么这应该是可能的。否则,不行。
我对所有这些并不是非常熟悉,但是您需要执行以下操作:
Sure. You could find an ftp client for node, then if your server has an ftp server going you can just interact with it.
The following is how you might go about getting real filesystem access to a remote server
If you have root access to the remote machine you are trying to interact with, yes it should be possible. Otherwise, no.
I am not super familiar with all of this, but you will need to do something along the lines of: