File tree 1 file changed +7
-4
lines changed
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');
60
60
const EventEmitter = require ( 'events' ) ;
61
61
const { FSReqWrap, statValues, kFsStatsFieldsLength } = binding ;
62
62
const { FSEvent } = process . binding ( 'fs_event_wrap' ) ;
63
- const promises = require ( 'internal/fs/promises' ) ;
64
63
const internalFS = require ( 'internal/fs/utils' ) ;
65
64
const { getPathFromURL } = require ( 'internal/url' ) ;
66
65
const internalUtil = require ( 'internal/util' ) ;
@@ -89,14 +88,18 @@ const {
89
88
CHAR_BACKWARD_SLASH ,
90
89
} = require ( 'internal/constants' ) ;
91
90
92
- let warn = true ;
91
+ // Lazy loaded
92
+ let promises ;
93
+
94
+ let promisesWarn = true ;
93
95
94
96
Object . defineProperty ( fs , 'promises' , {
95
97
configurable : true ,
96
98
enumerable : false ,
97
99
get ( ) {
98
- if ( warn ) {
99
- warn = false ;
100
+ if ( promisesWarn ) {
101
+ promises = require ( 'internal/fs/promises' ) ;
102
+ promisesWarn = false ;
100
103
process . emitWarning ( 'The fs.promises API is experimental' ,
101
104
'ExperimentalWarning' ) ;
102
105
}
You can’t perform that action at this time.
0 commit comments