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

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.