--allow-fs-read


稳定性: 1.1 - 处于活跃开发中

该标志使用 权限模型 配置文件系统读取权限。

🌐 This flag configures file system read permissions using the Permission Model.

--allow-fs-read 标志的有效参数是:

🌐 The valid arguments for the --allow-fs-read flag are:

  • * - 允许所有 FileSystemRead 操作。
  • 可以使用多个 --allow-fs-read 标志来允许多个路径。例如 --allow-fs-read=/folder1/ --allow-fs-read=/folder1/

示例可以在 文件系统权限 文档中找到。

🌐 Examples can be found in the File System Permissions documentation.

还需要允许初始化模块。请考虑以下示例:

🌐 The initializer module also needs to be allowed. Consider the following example:

$ node --experimental-permission index.js

Error: Access to this API has been restricted
    at node:internal/main/run_main_module:23:47 {
  code: 'ERR_ACCESS_DENIED',
  permission: 'FileSystemRead',
  resource: '/Users/rafaelgss/repos/os/node/index.js'
} 

该进程需要访问 index.js 模块:

🌐 The process needs to have access to the index.js module:

node --experimental-permission --allow-fs-read=/path/to/index.js index.js