Categories
JavaScript Answers

How to create full path with Node’s fs.mkdirSync?

Spread the love

Sometimes, we want to create full path with Node’s fs.mkdirSync.

In this article, we’ll look at how to create full path with Node’s fs.mkdirSync.

How to create full path with Node’s fs.mkdirSync?

To create full path with Node’s fs.mkdirSync, we can use mkdirSync with recursive set to true.

For instance, we write

fs.mkdirSync(targetDir, {
  recursive: true
});

to create a directory at the targetDir path by setting recursive to true in the object in the 2nd argument.

Conclusion

To create full path with Node’s fs.mkdirSync, we can use mkdirSync with recursive set to true.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *