Node.js: extra methods for the fs object like copy(), remove(), mkdirs()
<!-- Please fill out the following information if it applies to your issue: --> - **Operating System:** Debian 9 - **Node.js version:** 8.9.3 - **`fs-extra` version:** 5.0.0 Hi there. I ran into some cases where `remove()` was unable to remove a directory due to filename encoding issues. I believe there are similar issues using `empty`, `copy`, and `move` operations (and their sync counterparts - basically anything that relies on `fs.readdir` / `fs.readdirSync`). My issue arose when trying to `fs.remove()` some directories that were created from an unzip operation. During `remove`s / `rimraf`'s tree walk, some of the returned directories seemed not to exist (although they did), causing the final `unlink` operation to fail (since it wasn't actually successfully emptied). It seems that, in general, names on a file system are just byte sequences, which are not guaranteed to represent fully valid strings. This causes the bytes-> string -> bytes operation, that happens when listing and then operating on items in a directory using Node, to not always produce the same file name that it read. This encoding problem has been a known Node issue for a while, which is why an option was added to return `Buffer`s from `fs.readdir`. My suggestion is to update the affected methods to use this `Buffer` option. I'm happy to work on a PR, but I wanted to at least get some feedback and discuss the issue before diving in. Here are a couple Node issues relating to the file name encoding problem: https://github.com/nodejs/node-v0.x-archive/issues/2387 https://github.com/nodejs/node/pull/5616 Thanks!
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 rossj and has received 5 comments.