类:FileHandle


【Class: FileHandle

<FileHandle> 对象是用于数字文件描述符的对象封装器。

【A <FileHandle> object is an object wrapper for a numeric file descriptor.】

fsPromises.open() 方法会创建 <FileHandle> 对象的实例。

【Instances of the <FileHandle> object are created by the fsPromises.open() method.】

所有 <FileHandle> 对象都是 <EventEmitter>

【All <FileHandle> objects are <EventEmitter>s.】

如果 <FileHandle> 没有使用 filehandle.close() 方法关闭,它会尝试自动关闭文件描述符并发出进程警告,从而帮助防止内存泄漏。请不要依赖此行为,因为它可能不可靠,文件可能无法关闭。相反,应始终显式关闭 <FileHandle>。Node.js 未来可能会更改此行为。

【If a <FileHandle> is not closed using the filehandle.close() method, it will try to automatically close the file descriptor and emit a process warning, helping to prevent memory leaks. Please do not rely on this behavior because it can be unreliable and the file may not be closed. Instead, always explicitly close <FileHandle>s. Node.js may change this behavior in the future.】