Remixd:访问您的本地文件系统
警告
Remixd is deprecated. For workflows that require access to your local filesystem, use Remix Desktop instead. Remix Desktop has native filesystem access without the need to run a separate daemon process.
Download Remix Desktop from the releases page.
To give the Remix IDE (the web app) access to a folder on your computer, you need to use Remixd - the plugin along with Remixd - the cli/npm module.
The Remixd plugin can be activated from the plugin manager or in the File Explorer - see the image below. The connect to localhost - will activate the Remixd plugin.

一旦您点击connect to localhost 或从插件管理器激活Remixd,一个模态框将出现:

The Remixd plugin is a Websocket plugin and it has no UI other than this modal dialog box - so you won't see a Remixd icon in the icon panel.
Before you hit Connect, you need to install the Remixd NPM module and run the Remixd command.
The code of remixd is
here .
Remixd installation
remixd is an npm module and can be globally installed using the following command:
npm install -g @remix-project/remixd
或者删除-g标志,在您选择的目录中安装它:npm install @remix-project/remixd
NOTE: When the Remixd npm module is installed, it also installs Slither, solc-select and sets solc to latest version i.e. 0.8.15 currently.
ALSO NOTE: Python3.6+ (pip3) needs to already be installed on the System. (This packaging of Slither with the Remixd module is supported since Remixd v0.6.3). In case of any discrepancy, Slither can also be installed along with other dependencies using command remixd -i slither
Find your version of Remixd
命令:remixd -v 或 remixd --version 将返回您的版本号。
如果此命令不起作用,则说明您使用的是过时的版本!
Update to the latest Remixd
Because Remixd creates a bridge from the browser to your local filesystem, it is important that you have the latest version of script.
For users who had installed the version of Remixd from the VERY old npm address or for users who do not know which npm address they had installed it from, run these 2 steps:
卸载旧版:npm uninstall -g remixd
安装新版:npm install -g @remix-project/remixd
For Most Users who know that they have a Remixd version installed from @remix-project/remixd then just run:
npm install -g @remix-project/remixd
Remixd command
The remixd command without options uses the terminal's current directory as the shared directory and the shared Remix domain will be https://remix.ethereum.org, https://remix-alpha.ethereum.org, or https://remix-beta.ethereum.org
The remixd command is:
remixd
如果您正在从本地主机使用 Remix 或者没有在工作目录中运行该命令,则需要使用带有标志的命令。
remixd 选项
Usage: remixd [options]
Establish a two-way websocket connection between the local computer and Remix IDE for a folder
Options:
-v, --version output the version number
-u, --remix-ide <url> URL of remix instance allowed to connect
-s, --shared-folder <path> Folder to share with Remix IDE (Default: CWD)
-i, --install <name> Module name to install locally (Supported: ["slither"])
-r, --read-only Treat shared folder as read-only (experimental)
-h, --help output usage information
Example:
remixd -s ./shared_project -u http://localhost:8080
注意: remixd -i slither 可以用来安装Slither及其依赖项
HTTP vs HTTPS in the remixd command
If your browser is on https://remix.ethereum.org (secure http) then use HTTPS in the command:
remixd -s <absolute-path-to-the-shared-folder> --remix-ide https://remix.ethereum.org
Or if you are using http in the browser, then use http in the remixd command.
读/写权限和只读模式
The folder is shared using a Websocket connection between Remix IDE
and remixd.
请确保执行remixd的用户对该文件夹具有读/写权限。
Alternatively, there is an option to run remixd in read-only mode, use --read-only flag.
端口使用
remixd functions by making Websocket connections with Remix IDE on different ports. Ports are defined according to specific purpose. Port usage details are as:
65520 : For
remixdWebsocket listener, to share local file system with Remix IDE. Shared folder will be loaded in the Remix IDEFile Explorersworkspace namedlocalhost65522 : For
hardhatWebsocket listener, to enable the Hardhat Compilation using Remix IDESolidity Compilerplugin, if shared folder is a Hardhat project.65523 : For
slitherWebsocket listener, to enable the Slither Analysis using Remix IDESolidity Static Analysisplugin65524 : For
truffleWebsocket listener, to enable the Truffle Compilation using Remix IDESolidity Compilerplugin, if shared folder is a Truffle project.
**注意:**请确保您的系统足够安全,并且这些端口未打开或转发。
警告
remixd为任何能够访问本地主机上 TCP 端口 65520 的应用程序提供了给定文件夹的完全读写访问权限。为了最小化风险,Remixd 只能在您的文件系统和 Remix IDE URLS 之间进行桥接 - 包括:
https://remix.ethereum.org
https://remix-alpha.ethereum.org
https://remix-beta.ethereum.org
package://a7df6d3c223593f3550b35e90d7b0b1f.mod
package://6fd22d6fe5549ad4c4d8fd3ca0b7816b.mod
https://ipfsgw.komputing.org
(the package:// URLs in the list above are for remix desktop)
Clicking Connect on the modal
在Remixd模态框上点击“连接”按钮(见上图),将尝试启动一个会话,使您的浏览器可以访问计算机文件系统中指定的文件夹。
如果您没有在后台运行remixd - 会打开另一个模态框,并显示以下内容:
Cannot connect to the remixd daemon.
Please make sure you have the remixd running in the background.
Assuming you don't get the 2nd modal, your connection to the remixd daemon is successful. The shared folder will be visible in the File Explorer's workspace under localhost.

创建&删除文件&或文件
Clicking on the new folder or new file icon under localhost will create a new file or folder in the shared folder. Similarly, if you right click on a file or folder you can rename or delete the file.
Closing a remixd session
In the terminal where remixd is running, typing ctrl-c will close the session. Remix IDE will then put up a modal saying that remixd has stopped running.