SyntaxFix
Write A Post
Hire A Developer
Questions
With the fs-extra package you can do this with a one-liner:
const fs = require('fs-extra'); const dir = '/tmp/this/path/does/not/exist'; fs.ensureDirSync(dir);