We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 727631f commit 119682eCopy full SHA for 119682e
lib/internal/fs/promises.js
@@ -264,7 +264,8 @@ async function rename(oldPath, newPath) {
264
}
265
266
async function truncate(path, len = 0) {
267
- return ftruncate(await open(path, 'r+'), len);
+ const fd = await open(path, 'r+');
268
+ return ftruncate(fd, len).finally(fd.close.bind(fd));
269
270
271
async function ftruncate(handle, len = 0) {
0 commit comments