File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,6 @@ const { Readable, Writable } = require('stream');
6060const EventEmitter = require ( 'events' ) ;
6161const { FSReqWrap, statValues, kFsStatsFieldsLength } = binding ;
6262const { FSEvent } = process . binding ( 'fs_event_wrap' ) ;
63- const promises = require ( 'internal/fs/promises' ) ;
6463const internalFS = require ( 'internal/fs/utils' ) ;
6564const { getPathFromURL } = require ( 'internal/url' ) ;
6665const internalUtil = require ( 'internal/util' ) ;
@@ -89,14 +88,18 @@ const {
8988 CHAR_BACKWARD_SLASH ,
9089} = require ( 'internal/constants' ) ;
9190
92- let warn = true ;
91+ // Lazy loaded
92+ let promises ;
93+
94+ let promisesWarn = true ;
9395
9496Object . defineProperty ( fs , 'promises' , {
9597 configurable : true ,
9698 enumerable : false ,
9799 get ( ) {
98- if ( warn ) {
99- warn = false ;
100+ if ( promisesWarn ) {
101+ promises = require ( 'internal/fs/promises' ) ;
102+ promisesWarn = false ;
100103 process . emitWarning ( 'The fs.promises API is experimental' ,
101104 'ExperimentalWarning' ) ;
102105 }
You can’t perform that action at this time.
0 commit comments