tooling icon indicating copy to clipboard operation
tooling copied to clipboard

recursive filesystem operations api

Open boneskull opened this issue 5 years ago • 1 comments

We've got some feedback on the recursive rmdir API; see https://github.com/nodejs/node/issues/34278

Given that the recursive option is still experimental, we can still break it, if necessary. Note that the recursive option for mkdir is not marked experimental.

This may be a good topic for a deep-dive session as noted by @bengl in #73. Also, input on API design from @nodejs/fs would be helpful.

Questions include, but are not limited to:

  • Do we want to add more granular options to fs.rmdir? e.g., allowRetries, force
  • Do we want to move the recursive functionality to a new method, or a new module entirely?
  • Should POSIX alignment be a goal for the fs module? Even if not, should we stay out of it anyway?
  • fs.rmdir w/ recursive actually functions like rm -f if given a file instead of a directory. Should it do that?

Note: It does not sound like outright removal of this functionality is being suggested anywhere.

It's pretty clear to me, anyway, that the current API is a product of various constraints, and not necessarily technical ones...

boneskull avatar Jul 10 '20 19:07 boneskull

I commented in the meeting that much usage of these api's probably comes from a handful of fs wrapper libraries. To follow up on those, here are the most popular ones I know of:

  • https://github.com/jprichardson/node-fs-extra
    • I learned from this investigation that fs-extra actually wraps graceful-fs (see below)
  • https://github.com/isaacs/node-graceful-fs
    • I didn't find any direct coupling to the recursive apis, but I am new to this source so I could have missed it
  • https://github.com/sindresorhus/make-dir
    • It uses the recursive option in here. No evidence to me that this would break.

wesleytodd avatar Oct 21 '20 13:10 wesleytodd