fs.chmod(path, mode, callback)


异步地更改文件的权限。 除了可能的异常之外,没有为完成回调提供任何参数。

另见: chmod(2)

fs.chmod('my_file.txt', 0o775, (err) => {
  if (err) throw err;
  console.log('The permissions for file "my_file.txt" have been changed!');
});

Asynchronously changes the permissions of a file. No arguments other than a possible exception are given to the completion callback.

See also: chmod(2).

fs.chmod('my_file.txt', 0o775, (err) => {
  if (err) throw err;
  console.log('The permissions for file "my_file.txt" have been changed!');
});