Skip to content

feat: add fs/mkdir #2198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/node_modules/@stdlib/fs/mkdir/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ function onDir( error, path ) {

The function accepts the same `options` and has the same defaults as [`fs.mkdir()`][node-fs].

The `path` presents only if the `recursive` option is `true`, which is the first directory path created.

#### mkdir.sync( path\[, options] )

Synchronously creates a directory and any necessary subdirectories.
Expand All @@ -68,6 +70,8 @@ console.log( out );

The function accepts the same `options` and has the same defaults as [`fs.mkdirSync()`][node-fs].

The function returns `undefined`, or if `recursive` option is `true`, the first directory path created.


</section>

Expand Down
3 changes: 1 addition & 2 deletions lib/node_modules/@stdlib/fs/mkdir/examples/index.js
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In examples/index.js, I used rmdirSync to restore to pass the doctest. I know this is a bad idea but I would like to know what the best practice is.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

var join = require( 'path' ).join;
var rmdirSync = require( 'fs' ).rmdirSync; // eslint-disable-line node/no-sync
var mkdirSync = require( '@stdlib/fs/mkdir' ).sync;
var mkdir = require( '@stdlib/fs/mkdir' );

var dpath = join( __dirname, 'fixtures' );
Expand All @@ -29,7 +28,7 @@ var opts = {
'recursive': true
};

mkdirSync( dpath, opts );
mkdir.sync( dpath, opts );

function remove( path ) {
var opts = {
Expand Down
Loading