• path {string|Buffer|URL}
    • mode {string|integer}
    • callback {Function}
      • err {Error}

    异步地更改文件的权限。 除了可能的异常,完成回调没有其他参数。

    也可参见 chmod(2)。

    1. fs.chmod('my_file.txt', 0o775, (err) => {
    2. if (err) throw err;
    3. console.log('文件 “my_file.txt” 的权限已被更改');
    4. });