doc: document file mode caveats on Windows

- On Windows only the write permission (read-only bit) can be
  manipulated, and there is no distinction among owner, group
  or others.
- mkdir on Windows does not support the mode argument.

PR-URL: https://github.com/nodejs/node/pull/20636
Fixes: https://github.com/nodejs/node/issues/20498
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This commit is contained in:
Joyee Cheung 2018-05-10 01:26:42 +08:00
parent a18e130e59
commit f9de6f5804
No known key found for this signature in database
GPG Key ID: F586868AAD831D0C

View File

@ -1089,6 +1089,10 @@ For example, the octal value `0o765` means:
* The group may read and write the file. * The group may read and write the file.
* Others may read and execute the file. * Others may read and execute the file.
Caveats: on Windows only the write permission can be changed, and the
distinction among the permissions of group, owner or others is not
implemented.
## fs.chmodSync(path, mode) ## fs.chmodSync(path, mode)
<!-- YAML <!-- YAML
added: v0.6.7 added: v0.6.7
@ -1992,7 +1996,7 @@ changes:
--> -->
* `path` {string|Buffer|URL} * `path` {string|Buffer|URL}
* `mode` {integer} **Default:** `0o777` * `mode` {integer} Not supported on Windows. **Default:** `0o777`.
* `callback` {Function} * `callback` {Function}
* `err` {Error} * `err` {Error}
@ -2012,7 +2016,7 @@ changes:
--> -->
* `path` {string|Buffer|URL} * `path` {string|Buffer|URL}
* `mode` {integer} **Default:** `0o777` * `mode` {integer} Not supported on Windows. **Default:** `0o777`.
Synchronously creates a directory. Returns `undefined`. Synchronously creates a directory. Returns `undefined`.
This is the synchronous version of [`fs.mkdir()`][]. This is the synchronous version of [`fs.mkdir()`][].
@ -2132,7 +2136,8 @@ changes:
Asynchronous file open. See open(2). Asynchronous file open. See open(2).
`mode` sets the file mode (permission and sticky bits), but only if the file was `mode` sets the file mode (permission and sticky bits), but only if the file was
created. created. Note that on Windows only the write permission can be manipulated,
see [`fs.chmod()`][].
The callback gets two arguments `(err, fd)`. The callback gets two arguments `(err, fd)`.