Skip to content

Commit 78eea4c

Browse files
author
pluris
committed
fixup! fs: improve error performance fori fsyncSync
1 parent 053c6fb commit 78eea4c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/internal/fs/sync.js

+2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ function unlink(path) {
9494
}
9595

9696
function fsync(fd) {
97+
fd = getValidatedFd(fd);
98+
9799
return binding.fsyncSync(fd);
98100
}
99101

typings/internalBinding/fs.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ declare namespace InternalFSBinding {
9494
function fstat(fd: number, useBigint: boolean, usePromises: typeof kUsePromises): Promise<Float64Array | BigUint64Array>;
9595
function fstat(fd: number, useBigint: true, usePromises: typeof kUsePromises): Promise<BigUint64Array>;
9696
function fstat(fd: number, useBigint: false, usePromises: typeof kUsePromises): Promise<Float64Array>;
97-
function fsync(fd: number): void;
9897

99-
function fsyncSync(fd: number, req: FSReqCallback): void;
100-
function fsyncSync(fd: number, req: undefined, ctx: FSSyncContext): void;
101-
function fsyncSync(fd: number, usePromises: typeof kUsePromises): Promise<void>;
98+
function fsync(fd: number, req: FSReqCallback): void;
99+
function fsync(fd: number, req: undefined, ctx: FSSyncContext): void;
100+
function fsync(fd: number, usePromises: typeof kUsePromises): Promise<void>;
101+
function fsyncSync(fd: number): void;
102102

103103
function ftruncate(fd: number, len: number, req: FSReqCallback): void;
104104
function ftruncate(fd: number, len: number, req: undefined, ctx: FSSyncContext): void;

0 commit comments

Comments
 (0)