From 9b43af3703a129021f4f8ed653fe06beb7f8c8d1 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 14 May 2018 16:39:54 -0700 Subject: [PATCH] fs: lazy load createPromise/promiseResolve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/20766 Reviewed-By: Joyee Cheung Reviewed-By: Michaƫl Zasso Reviewed-By: Minwoo Jung Reviewed-By: Tiancheng "Timothy" Gu Reviewed-By: Benjamin Gruenbaum Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater --- lib/fs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fs.js b/lib/fs.js index fedd4dcdb54df2..bf6f93ebb7bf05 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -44,7 +44,6 @@ const { const util = require('util'); const pathModule = require('path'); const { isUint8Array } = require('internal/util/types'); -const { createPromise, promiseResolve } = process.binding('util'); const binding = process.binding('fs'); const fs = exports; @@ -248,6 +247,7 @@ fs.exists = function(path, callback) { Object.defineProperty(fs.exists, internalUtil.promisify.custom, { value: (path) => { + const { createPromise, promiseResolve } = process.binding('util'); const promise = createPromise(); fs.exists(path, (exists) => promiseResolve(promise, exists)); return promise;