fsPromises.open(path, flags[, mode])
-
flags
<string> | <number> 参见 支持文件系统flags
。默认值:'r'
。¥
flags
<string> | <number> See support of file systemflags
. Default:'r'
. -
mode
<string> | <integer> 如果创建文件,则设置文件模式(权限和粘性位)。默认值:0o666
(可读可写)¥
mode
<string> | <integer> Sets the file mode (permission and sticky bits) if the file is created. Default:0o666
(readable and writable) -
返回:<Promise> 使用 <FileHandle> 对象实现。
¥Returns: <Promise> Fulfills with a <FileHandle> object.
打开 <FileHandle>。
¥Opens a <FileHandle>.
有关更多详细信息,请参阅 POSIX open(2)
文档。
¥Refer to the POSIX open(2)
documentation for more detail.
如 命名文件、路径、以及命名空间 所述,某些字符 (< > : " / \ | ? *
) 在 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.