Promise API
【Promises API】
fs/promises API 提供返回 promise 的异步文件系统方法。
【The fs/promises API provides asynchronous file system methods that return
promises.】
Promise API 使用底层的 Node.js 线程池在事件循环线程之外执行文件系统操作。这些操作不是同步的,也不是线程安全的。在对同一个文件进行多次并发修改时必须小心,否则可能会导致数据损坏。
【The promise APIs use the underlying Node.js threadpool to perform file system operations off the event loop thread. These operations are not synchronized or threadsafe. Care must be taken when performing multiple concurrent modifications on the same file or data corruption may occur.】