Skip to content

Latest commit

 

History

History
24 lines (19 loc) · 708 Bytes

211001.md

File metadata and controls

24 lines (19 loc) · 708 Bytes

nodejs 配置文件权限

在 windows 环境下配置文件只读属性,需要 shell 插件

文件只读

// path 文件路径
shell.chmod('-R', 'a-w', path)

解除文件只读

// path 文件路径
shell.chmod('-R', 'a+rw', path)

shell chmod 详解

  1. -R: 对目前目录下的所有档案与子目录进行相同的权限变更(即以递回的方式逐个变更)
  2. -c : 若该档案权限确实已经更改,才显示其更改动作
  3. -f : 若该档案权限无法被更改也不要显示错误讯息
  4. -v : 显示权限变更的详细资料
  5. a+rw 中 + 表示增加权限、- 表示取消权限、= 表示唯一设定权限
  6. r 表示可读取,w 表示可写入