| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f871bc6 commit 287a02c
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,7 +43,7 @@ const { | |||
| 43 | 43 | aggregateTwoErrors, | |
| 44 | 44 | } = require('internal/errors'); | |
| 45 | 45 | const { isArrayBufferView } = require('internal/util/types'); | |
| 46 | - const { rimrafPromises } = require('internal/fs/rimraf'); | ||
| 46 | + | ||
| 47 | 47 | const { | |
| 48 | 48 | constants: { | |
| 49 | 49 | kIoMaxLength, | |
@@ -92,6 +92,7 @@ const { | |||
| 92 | 92 | kEmptyObject, | |
| 93 | 93 | lazyDOMException, | |
| 94 | 94 | promisify, | |
| 95 | + getLazy, | ||
| 95 | 96 | } = require('internal/util'); | |
| 96 | 97 | const { EventEmitterMixin } = require('internal/event_target'); | |
| 97 | 98 | const { StringDecoder } = require('string_decoder'); | |
@@ -135,6 +136,8 @@ function lazyFsStreams() { | |||
| 135 | 136 | return fsStreams ??= require('internal/fs/streams'); | |
| 136 | 137 | } | |
| 137 | 138 | ||
| 139 | + const lazyRimRaf = getLazy(() => require('internal/fs/rimraf').rimrafPromises); | ||
| 140 | + | ||
| 138 | 141 | class FileHandle extends EventEmitterMixin(JSTransferable) { | |
| 139 | 142 | /** | |
| 140 | 143 | * @param {InternalFSBinding.FileHandle | undefined} filehandle | |
@@ -749,7 +752,7 @@ async function ftruncate(handle, len = 0) { | |||
| 749 | 752 | async function rm(path, options) { | |
| 750 | 753 | path = pathModule.toNamespacedPath(getValidatedPath(path)); | |
| 751 | 754 | options = await validateRmOptionsPromise(path, options, false); | |
| 752 | - return rimrafPromises(path, options); | ||
| 755 | + return lazyRimRaf()(path, options); | ||
| 753 | 756 | } | |
| 754 | 757 | ||
| 755 | 758 | async function rmdir(path, options) { | |
@@ -760,7 +763,7 @@ async function rmdir(path, options) { | |||
| 760 | 763 | emitRecursiveRmdirWarning(); | |
| 761 | 764 | const stats = await stat(path); | |
| 762 | 765 | if (stats.isDirectory()) { | |
| 763 | - return rimrafPromises(path, options); | ||
| 766 | + return lazyRimRaf()(path, options); | ||
| 764 | 767 | } | |
| 765 | 768 | } | |
| 766 | 769 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments