fs.open(path[, flags[, mode]], callback)

异步地打开文件。参阅 open(2)

mode 设置文件模式(权限和粘滞位),但仅限于创建文件的情况。 在 Windows 上,只能操作写权限,参阅 fs.chmod()

回调有两个参数 (err, fd)

有些字符 (< > : " / \ | ? *) 在 Windows 上是预留的,参阅命名文件、路径以及命名空间。 在 NTFS 上,如果文件名包含冒号,则 Node.js 将打开文件系统流,参阅此 MSDN 页面

基于 fs.open() 的函数也表现出以上行为,比如 fs.writeFile()fs.readFile() 等。

Asynchronous file open. See open(2).

mode sets the file mode (permission and sticky bits), but only if the file was created. On Windows, only the write permission can be manipulated; see fs.chmod().

The callback gets two arguments (err, fd).

Some characters (< > : " / \ | ? *) are reserved under Windows as documented by Naming Files, Paths, and Namespaces. Under NTFS, if the filename contains a colon, Node.js will open a file system stream, as described by this MSDN page.

Functions based on fs.open() exhibit this behavior as well: fs.writeFile(), fs.readFile(), etc.