[node.js] How to create full path with node's fs.mkdirSync?

One option is to use shelljs module

npm install shelljs

var shell = require('shelljs');
shell.mkdir('-p', fullPath);

From that page:

Available options:

p: full path (will create intermediate dirs if necessary)

As others have noted, there's other more focused modules. But, outside of mkdirp, it has tons of other useful shell operations (like which, grep etc...) and it works on windows and *nix