From fa0cac51b9d30c5ce3a1f82aba02754be447ae65 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 0d9387598ed..6b0a88fac7a 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; @@ -250,6 +249,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;