(path, { 0: names, 1: types }, callback)
| 250 | } |
| 251 | |
| 252 | function getDirents(path, { 0: names, 1: types }, callback) { |
| 253 | let i; |
| 254 | if (typeof callback === 'function') { |
| 255 | const len = names.length; |
| 256 | let toFinish = 0; |
| 257 | callback = once(callback); |
| 258 | for (i = 0; i < len; i++) { |
| 259 | const type = types[i]; |
| 260 | if (type === UV_DIRENT_UNKNOWN) { |
| 261 | const name = names[i]; |
| 262 | const idx = i; |
| 263 | toFinish++; |
| 264 | let filepath; |
| 265 | try { |
| 266 | filepath = join(path, name); |
| 267 | } catch (err) { |
| 268 | callback(err); |
| 269 | return; |
| 270 | } |
| 271 | lazyLoadFs().lstat(filepath, (err, stats) => { |
| 272 | if (err) { |
| 273 | callback(err); |
| 274 | return; |
| 275 | } |
| 276 | names[idx] = new DirentFromStats(name, stats, path); |
| 277 | if (--toFinish === 0) { |
| 278 | callback(null, names); |
| 279 | } |
| 280 | }); |
| 281 | } else { |
| 282 | names[i] = new Dirent(names[i], types[i], path); |
| 283 | } |
| 284 | } |
| 285 | if (toFinish === 0) { |
| 286 | callback(null, names); |
| 287 | } |
| 288 | } else { |
| 289 | const len = names.length; |
| 290 | for (i = 0; i < len; i++) { |
| 291 | names[i] = getDirent(path, names[i], types[i]); |
| 292 | } |
| 293 | return names; |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | function getDirent(path, name, type, callback) { |
| 298 | if (typeof callback === 'function') { |
no test coverage detected
searching dependent graphs…