{"name":"make-dir","version":"5.1.0","description":"Make a directory and its parents if needed - Think `mkdir -p`","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/make-dir.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsd"},"keywords":["mkdir","mkdirp","make","directories","folders","directory","folder","path","parent","parents","intermediate","recursively","recursive","create","fs","filesystem","file-system"],"devDependencies":{"@types/graceful-fs":"^4.1.9","@types/node":"^20.12.8","ava":"^6.1.2","graceful-fs":"^4.2.11","path-type":"^5.0.0","tempy":"^3.1.0","tsd":"^0.31.0","xo":"^0.58.0"},"ava":{"workerThreads":false},"_id":"make-dir@5.1.0","gitHead":"5e4210dea885f2d45a8af8839e836a14aacdbf06","types":"./index.d.ts","bugs":{"url":"https://github.com/sindresorhus/make-dir/issues"},"homepage":"https://github.com/sindresorhus/make-dir#readme","_nodeVersion":"20.19.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-IfpFq6UM39dUNiphpA6uDezNx/AvWyhwfICWPR3t1VspkgkMZrL+Rk1RbN1bx+aeNYwOrqGJgEgV3yotk+ZUVw==","shasum":"59b2d9acf7ffa543d14238617a697458fa8dd5c9","tarball":"http://registry-npm.ywwl.com/make-dir/download/make-dir-5.1.0.tgz","fileCount":5,"unpackedSize":9557,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEUSyVipb3XJogBdgaKEyrq66zyo8GdMnVGbGOHezO6WAiBH89ZbCnbulyBH3WXL4Ycvll4P4AAc58c8aqa2B8HeZA=="}],"size":3450,"noattachment":false,"key":"/make-dir/-/make-dir-5.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/make-dir_5.1.0_1757528675610_0.5448277798656365"},"_hasShrinkwrap":false,"readme":"# make-dir\n\n> Make a directory and its parents if needed - Think `mkdir -p`\n\n> [!TIP]\n> You probably want the built-in [`fsPromises.mkdir('…', {recursive: true})`](https://nodejs.org/api/fs.html#fspromisesmkdirpath-options) instead.\n\n### Advantages over `fsPromises.mkdir('…', {recursive: true})`\n\n- Supports a custom `fs` implementation.\n\n### Advantages over [`mkdirp`](https://github.com/isaacs/node-mkdirp)\n\n- Promise API *(Async/await ready!)*\n- Fixes many `mkdirp` issues\n- CI-tested on macOS, Linux, and Windows\n- Actively maintained\n- Doesn't bundle a CLI\n- Uses the native `fs.mkdir/mkdirSync` [`recursive` option](https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_mkdir_path_options_callback) in Node.js unless [overridden](#fs)\n\n## Install\n\n```sh\nnpm install make-dir\n```\n\n## Usage\n\n```console\n$ pwd\n/Users/sindresorhus/fun\n$ tree\n.\n```\n\n```js\nimport {makeDirectory} from 'make-dir';\n\nconst path = await makeDirectory('unicorn/rainbow/cake');\n\nconsole.log(path);\n//=> '/Users/sindresorhus/fun/unicorn/rainbow/cake'\n```\n\n```console\n$ tree\n.\n└── unicorn\n    └── rainbow\n        └── cake\n```\n\nMultiple directories:\n\n```js\nimport {makeDirectory} from 'make-dir';\n\nconst paths = await Promise.all([\n\tmakeDirectory('unicorn/rainbow'),\n\tmakeDirectory('foo/bar')\n]);\n\nconsole.log(paths);\n/*\n[\n\t'/Users/sindresorhus/fun/unicorn/rainbow',\n\t'/Users/sindresorhus/fun/foo/bar'\n]\n*/\n```\n\n## API\n\n### makeDirectory(path, options?)\n\nReturns a `Promise` for the path to the created directory.\n\n### makeDirectorySync(path, options?)\n\nReturns the path to the created directory.\n\n#### path\n\nType: `string | URL`\n\nThe directory to create.\n\n#### options\n\nType: `object`\n\n##### mode\n\nType: `integer`\\\nDefault: `0o777`\n\nThe directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/).\n\n##### fs\n\nType: `object`\\\nDefault: `import fs from 'node:fs'`\n\nUse a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs).\n\nUsing a custom `fs` implementation will block the use of the native `recursive` option if `fs.mkdir` or `fs.mkdirSync` is not the native function.\n\n## Related\n\n- [make-dir-cli](https://github.com/sindresorhus/make-dir-cli) - CLI for this module\n- [del](https://github.com/sindresorhus/del) - Delete files and directories\n- [globby](https://github.com/sindresorhus/globby) - User-friendly glob matching\n- [cpy](https://github.com/sindresorhus/cpy) - Copy files\n- [cpy-cli](https://github.com/sindresorhus/cpy-cli) - Copy files on the command-line\n- [move-file](https://github.com/sindresorhus/move-file) - Move a file\n","publish_time":1757528675819,"_cnpm_publish_time":1757528675819,"dist-tags":{"latest":"5.1.0"}}