Skip to content

Commit e1ebe02

Browse files
author
pluris
committed
fixup! fs: improve error performance fori fsyncSync
1 parent 19748b8 commit e1ebe02

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
@@ -89,6 +89,8 @@ function close(fd) {
8989
}
9090

9191
function fsync(fd) {
92+
fd = getValidatedFd(fd);
93+
9294
return binding.fsyncSync(fd);
9395
}
9496

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)