Skip to content

Commit 7176048

Browse files
committed
lib: give names to promisified exists() and question()
nodejs/node#43218
1 parent 393da32 commit 7176048

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

lib/asar/fs-wrapper.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
263263
};
264264

265265
const { lstat } = fs;
266-
fs.lstat = function (pathArgument: string, options: any, callback: any) {
266+
fs.lstat = (pathArgument: string, options: any, callback: any) => {
267267
const pathInfo = splitPath(pathArgument);
268268
if (typeof options === 'function') {
269269
callback = options;
@@ -382,10 +382,10 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
382382

383383
fs.promises.realpath = util.promisify(fs.realpath.native);
384384

385-
const { exists } = fs;
386-
fs.exists = (pathArgument: string, callback: any) => {
385+
const { exists: nativeExists } = fs;
386+
fs.exists = function exists (pathArgument: string, callback: any) {
387387
const pathInfo = splitPath(pathArgument);
388-
if (!pathInfo.isAsar) return exists(pathArgument, callback);
388+
if (!pathInfo.isAsar) return nativeExists(pathArgument, callback);
389389
const { asarPath, filePath } = pathInfo;
390390

391391
const archive = getOrCreateArchive(asarPath);
@@ -399,9 +399,9 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
399399
nextTick(callback, [pathExists]);
400400
};
401401

402-
fs.exists[util.promisify.custom] = (pathArgument: string) => {
402+
fs.exists[util.promisify.custom] = function exists (pathArgument: string) {
403403
const pathInfo = splitPath(pathArgument);
404-
if (!pathInfo.isAsar) return exists[util.promisify.custom](pathArgument);
404+
if (!pathInfo.isAsar) return nativeExists[util.promisify.custom](pathArgument);
405405
const { asarPath, filePath } = pathInfo;
406406

407407
const archive = getOrCreateArchive(asarPath);
@@ -413,6 +413,8 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
413413
return Promise.resolve(archive.stat(filePath) !== false);
414414
};
415415

416+
console.log(fs);
417+
416418
const { existsSync } = fs;
417419
fs.existsSync = (pathArgument: string) => {
418420
const pathInfo = splitPath(pathArgument);

0 commit comments

Comments
 (0)