summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Jefe Lindstaedt <robert.lindstaedt@gmail.com>2016-04-21 09:49:59 +0200
committerJames M Snell <jasnell@gmail.com>2016-04-22 11:32:22 -0700
commitae991e757732aad13af1a4b2ecf66840937f04e1 (patch)
treeb5b85f923622172ec66309e654f13c15bb4c8026
parenta3b5b9cbf2cb858bdb7c5e5b1e3c8b92c43a1c4a (diff)
downloadandroid-node-v8-ae991e757732aad13af1a4b2ecf66840937f04e1.tar.gz
android-node-v8-ae991e757732aad13af1a4b2ecf66840937f04e1.tar.bz2
android-node-v8-ae991e757732aad13af1a4b2ecf66840937f04e1.zip
doc: add note for platform specific flags `fs.open()`
Note describing platform specific differences in fs.open E.g. fs.open('<directory>', 'a+', console.log) Fixes: https://github.com/nodejs/node/issues/3643 PR-URL: https://github.com/nodejs/node/pull/6136 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
-rw-r--r--doc/api/fs.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/api/fs.md b/doc/api/fs.md
index 4364b1cc5c..1d64f73633 100644
--- a/doc/api/fs.md
+++ b/doc/api/fs.md
@@ -795,6 +795,23 @@ On Linux, positional writes don't work when the file is opened in append mode.
The kernel ignores the position argument and always appends the data to
the end of the file.
+_Note: The behavior of `fs.open()` is platform specific for some flags. As such,
+opening a directory on OS X and Linux with the `'a+'` flag - see example below -
+will return an error. Whereas on Windows and FreeBSD a file descriptor will be
+returned._
+
+```js
+// OS X and Linux
+fs.open('<directory>', 'a+', (err, fd) => {
+ // => [Error: EISDIR: illegal operation on a directory, open <directory>]
+})
+
+// Windows and FreeBSD
+fs.open('<directory>', 'a+', (err, fd) => {
+ // => null, <fd>
+})
+```
+
## fs.openSync(path, flags[, mode])
* `path` {String | Buffer}