FileHandle 类
<FileHandle> 对象是数字文件描述符的对象封装。
<FileHandle> 对象的实例通过 fsPromises.open()
方法创建。
所有 <FileHandle> 对象都是 <EventEmitter>。
如果未使用 filehandle.close()
方法关闭 <FileHandle>,则它将尝试自动关闭文件描述符并触发进程警告,从而有助于防止内存泄漏。
请不要依赖此行为,因为它可能不可靠并且该文件可能未被关闭。
而是,始终显式关闭 <FileHandle>。
Node.js 将来可能会更改此行为。
A <FileHandle> object is an object wrapper for a numeric file descriptor.
Instances of the <FileHandle> object are created by the fsPromises.open()
method.
All <FileHandle> objects are <EventEmitter>s.
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.