diff --git a/lib/internal/fs/sync.js b/lib/internal/fs/sync.js index 56f82fd48426c6..f2a8c8a95638dd 100644 --- a/lib/internal/fs/sync.js +++ b/lib/internal/fs/sync.js @@ -89,6 +89,8 @@ function close(fd) { } function fsync(fd) { + fd = getValidatedFd(fd); + return binding.fsyncSync(fd); } diff --git a/typings/internalBinding/fs.d.ts b/typings/internalBinding/fs.d.ts index a4ea9987cd8198..9e91a72ea5794d 100644 --- a/typings/internalBinding/fs.d.ts +++ b/typings/internalBinding/fs.d.ts @@ -94,11 +94,11 @@ declare namespace InternalFSBinding { function fstat(fd: number, useBigint: boolean, usePromises: typeof kUsePromises): Promise; function fstat(fd: number, useBigint: true, usePromises: typeof kUsePromises): Promise; function fstat(fd: number, useBigint: false, usePromises: typeof kUsePromises): Promise; - function fsync(fd: number): void; - function fsyncSync(fd: number, req: FSReqCallback): void; - function fsyncSync(fd: number, req: undefined, ctx: FSSyncContext): void; - function fsyncSync(fd: number, usePromises: typeof kUsePromises): Promise; + function fsync(fd: number, req: FSReqCallback): void; + function fsync(fd: number, req: undefined, ctx: FSSyncContext): void; + function fsync(fd: number, usePromises: typeof kUsePromises): Promise; + function fsyncSync(fd: number): void; function ftruncate(fd: number, len: number, req: FSReqCallback): void; function ftruncate(fd: number, len: number, req: undefined, ctx: FSSyncContext): void;