Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3a55bd9

Browse filesBrowse files
gurgundayruyadorno
authored andcommitted
fs: lazily load ReadFileContext
PR-URL: #55998 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jason Zhang <xzha4350@gmail.com>
1 parent bb4aa7a commit 3a55bd9
Copy full SHA for 3a55bd9

File tree

Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Open diff view settings
Collapse file

‎lib/fs.js‎

Copy file name to clipboardExpand all lines: lib/fs.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ let WriteStream;
162162
let rimraf;
163163
let rimrafSync;
164164
let kResistStopPropagation;
165+
let ReadFileContext;
165166

166167
// These have to be separate because of how graceful-fs happens to do it's
167168
// monkeypatching.
@@ -363,7 +364,7 @@ function readFile(path, options, callback) {
363364
callback ||= options;
364365
validateFunction(callback, 'cb');
365366
options = getOptions(options, { flag: 'r' });
366-
const ReadFileContext = require('internal/fs/read/context');
367+
ReadFileContext ??= require('internal/fs/read/context');
367368
const context = new ReadFileContext(callback, options.encoding);
368369
context.isUserFd = isFd(path); // File descriptor ownership
369370

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.