- Published on
Creating Recursive Directories in Node.js like mkdir -p
- Authors
- Name
- Ashik Nesin
- @AshikNesin
Ever wanted to create recursive directories with you Node.js code?
Here is how to do it without any dependencies
import { mkdir } from 'fs/promises';
// const { mkdir } = require('fs/promises') // CommonJS
const createRecursiveDir = async filepath => mkdir(filepath, { recursive: true })
Happy nested directories!