Skip to content

Commit 6274f17

Browse files
committed
Fix fs.exists
callbackify seems to always adds an error as the first argument. Opted to just use the promise for this one.
1 parent a929d9c commit 6274f17

File tree

1 file changed

+1
-3
lines changed
  • packages/protocol/src/browser/modules

1 file changed

+1
-3
lines changed

packages/protocol/src/browser/modules/fs.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ export class FsModule {
9898
}
9999

100100
public exists = (path: fs.PathLike, callback: (exists: boolean) => void): void => {
101-
callbackify(this.proxy.exists)(path, (exists) => {
102-
callback!(exists as any);
103-
});
101+
this.proxy.exists(path).then((exists) => callback(exists)).catch(() => callback(false));
104102
}
105103

106104
public fchmod = (fd: number, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void => {

0 commit comments

Comments
 (0)