stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

[RFC]: add `fs/mkdir`

Open C0ldSmi1e opened this issue 1 year ago • 5 comments

Description

This RFC proposes adding the package @stdlib/fs/mkdir for creating a directory asynchronously and synchronously.

Package: @stdlib/fs/mkdir

var mkdir = require( '@stdlib/fs/mkdir' );
var mkdirSync = require( '@stdlib/fs/mkdir' ).sync;

Related Issues

None.

Questions

No.

Other

No.

Checklist

  • [X] I have read and understood the Code of Conduct.
  • [X] Searched for existing issues and pull requests.
  • [X] The issue name begins with RFC:.

C0ldSmi1e avatar Apr 03 '24 22:04 C0ldSmi1e

Hi @kgryte , can I work on this?

C0ldSmi1e avatar Apr 03 '24 22:04 C0ldSmi1e

:wave: Hi there! :wave:

And thank you for opening your first issue! We will get back to you shortly. :runner: :dash:

stdlib-bot avatar Apr 03 '24 22:04 stdlib-bot

@Daniel777y Yes, this would be useful. Note, however, that you'll want to accommodate older Node.js environments not supporting the options object (and hence recursive). You can consult https://github.com/isaacs/node-mkdirp, but note that the default API for that package is now promise-based. You'll want to provide only a callback async API for fs/mkdir. Older versions of node-mkdirp were callback-based, but newer versions may have resolved some bugs. In short, you'll need to do some R&D to provide a polyfill for older Node.js versions.

kgryte avatar Apr 04 '24 23:04 kgryte

@Daniel777y Yes, this would be useful. Note, however, that you'll want to accommodate older Node.js environments not supporting the options object (and hence recursive). You can consult https://github.com/isaacs/node-mkdirp, but note that the default API for that package is now promise-based. You'll want to provide only a callback async API for fs/mkdir. Older versions of node-mkdirp were callback-based, but newer versions may have resolved some bugs. In short, you'll need to do some R&D to provide a polyfill for older Node.js versions.

Hi, @kgryte , just to clarity, I only need to align with the latest usage but to accommodate older Node.js environments, right? For example, callback was optional in older versions, but not passing it will still throw an error in stdlib. Correct me if I am wrong.

C0ldSmi1e avatar Apr 11 '24 07:04 C0ldSmi1e

Yes, I think that makes sense.

kgryte avatar Apr 11 '24 07:04 kgryte