create path if not exist node js

const fs = require('fs'); const path = '/path/to/directory';

if (!fs.existsSync(path)) { fs.mkdirSync(path, { recursive: true }); }