A Node.js file system walker with a Readable stream interface. Extracted from fs-extra.
Hi, Imagine that I want to walk through the directory contents and remove all the directories there. Here is my directory: ``` tmp ├── dir1 │ └── hello.txt ├── dir2 ├── dir3 └── hello.txt 3 directories, 2 files ``` Here is my code: ``` javascript 'use strict'; const klaw = require('klaw'); const through2 = require('through2'); const fs = require('fs-extra'); fs.walk('./tmp') .pipe(through2.obj((function (item, enc, next) { if (item.stats.isDirectory()) { fs.remove(item.path) } next(); }))) /*.on('data', function (item) { })*/ .on('end', function () { console.log('end of everything'); }) ``` Here is the error I have during the execution:  After the execution the directory looks the next way: ``` tmp └── dir1 └── hello.txt 1 directory, 1 file ``` I have tried different variants, including the marking the items as removed, but I haven't yet found anything working. Could you, please, clarify if it's possible to cleanup the directory while "klawling" through it? Regards,
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be still under discussion. The issue was opened by PavelPolyakov and has received 3 comments.