stdlib-js/stdlib

[RFC]: add `fs/mkdir`

Daniel777y opened this issue ยท 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

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

Hi @kgryte , can I work on this?

๐Ÿ‘‹ Hi there! ๐Ÿ‘‹

And thank you for opening your first issue! We will get back to you shortly. ๐Ÿƒ ๐Ÿ’จ

@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.

@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.

Yes, I think that makes sense.