fs.open(path[, flags[, mode]], callback)
path<string> | <Buffer> | <URL>flags<string> | <number> 参见 文件系统flags支持。 默认值:'r'。mode<string> | <integer> 默认值:0o666(可读可写)callback<Function>
异步文件打开。详情请参阅 POSIX open(2) 文档。
【Asynchronous file open. See the POSIX open(2) documentation for more details.】
mode 设置文件模式(权限和粘滞位),但仅在文件被创建时有效。在 Windows 上,只能修改写权限;参见 fs.chmod()。
回调函数接收两个参数 (err, fd)。
【The callback gets two arguments (err, fd).】
在 Windows 系统下,一些字符(< > : " / \ | ? *)是保留的,如 命名文件、路径和命名空间 所述。在 NTFS 中,如果文件名包含冒号,Node.js 将会打开文件系统流,如 这个 MSDN 页面 所述。
【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.】
基于 fs.open() 的函数也表现出这种行为:fs.writeFile()、fs.readFile() 等。
【Functions based on fs.open() exhibit this behavior as well:
fs.writeFile(), fs.readFile(), etc.】