--allow-fs-read
版本历史
| 版本 | 变更 |
|---|---|
| v24.2.0 | 允许隐式读取应用的入口点。 |
| v23.5.0, v22.13.0 | 权限模型和 --allow-fs 标志是稳定的。 |
| v20.7.0 | 不再允许使用逗号 ( |
| v20.0.0 | 新增于: v20.0.0 |
此标志使用 权限模型 配置文件系统读取权限。
\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操作。\
*- To allow allFileSystemReadoperations. -
使用多个
--allow-fs-read标志可以允许多个路径。示例--allow-fs-read=/folder1/ --allow-fs-read=/folder1/\Multiple paths can be allowed using multiple
--allow-fs-readflags. Example--allow-fs-read=/folder1/ --allow-fs-read=/folder1/
可以在 文件系统权限 文档中找到示例。
\Examples can be found in the File System Permissions documentation.
初始化模块和自定义 --require 模块具有隐式读取权限。
\The initializer module and custom --require modules has a implicit
read permission.
$ node --permission -r custom-require.js -r custom-require-2.js index.js -
custom-require.js、custom-require-2.js和index.js将默认位于允许读取列表中。\The
custom-require.js,custom-require-2.js, andindex.jswill be by default in the allowed read list.
process.has('fs.read', 'index.js'); // true
process.has('fs.read', 'custom-require.js'); // true
process.has('fs.read', 'custom-require-2.js'); // true