MCPcopy Index your code
hub / github.com/nodejs/node / _rmchildren

Function _rmchildren

lib/internal/fs/rimraf.js:122–156  ·  view source on GitHub ↗
(path, options, callback)

Source from the content-addressed store, hash-verified

120
121
122function _rmchildren(path, options, callback) {
123 const pathBuf = Buffer.from(path);
124
125 readdir(pathBuf, readdirEncoding, (err, files) => {
126 if (err)
127 return callback(err);
128
129 let numFiles = files.length;
130
131 if (numFiles === 0)
132 return rmdir(path, callback);
133
134 let done = false;
135
136 const childPathPrefix = Buffer.concat([pathBuf, separator]);
137
138 for (let i = 0; i < files.length; i++) {
139 const childPath = Buffer.concat([childPathPrefix, files[i]]);
140
141 rimraf(childPath, options, (err) => {
142 if (done)
143 return;
144
145 if (err) {
146 done = true;
147 return callback(err);
148 }
149
150 numFiles--;
151 if (numFiles === 0)
152 rmdir(path, callback);
153 });
154 }
155 });
156}
157
158
159function rimrafPromises(path, options) {

Callers 1

_rmdirFunction · 0.85

Calls 6

rimrafFunction · 0.85
concatMethod · 0.80
readdirFunction · 0.70
rmdirFunction · 0.70
callbackFunction · 0.50
fromMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…