CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
readme.md126 linesDownload Raw Back to make-dir
1# make-dir [![codecov](https://codecov.io/gh/sindresorhus/make-dir/branch/main/graph/badge.svg)](https://codecov.io/gh/sindresorhus/make-dir)2 3> Make a directory and its parents if needed - Think `mkdir -p`4 5## Advantages over [`mkdirp`](https://github.com/substack/node-mkdirp)6 7- Promise API *(Async/await ready!)*8- Fixes many `mkdirp` issues: [#96](https://github.com/substack/node-mkdirp/pull/96) [#70](https://github.com/substack/node-mkdirp/issues/70) [#66](https://github.com/substack/node-mkdirp/issues/66)9- 100% test coverage10- CI-tested on macOS, Linux, and Windows11- Actively maintained12- Doesn't bundle a CLI13- 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 >=10.12.0 unless [overridden](#fs)14 15## Install16 17```18$ npm install make-dir19```20 21## Usage22 23```24$ pwd25/Users/sindresorhus/fun26$ tree27.28```29 30```js31const makeDir = require('make-dir');32 33(async () => {34	const path = await makeDir('unicorn/rainbow/cake');35 36	console.log(path);37	//=> '/Users/sindresorhus/fun/unicorn/rainbow/cake'38})();39```40 41```42$ tree43.44└── unicorn45    └── rainbow46        └── cake47```48 49Multiple directories:50 51```js52const makeDir = require('make-dir');53 54(async () => {55	const paths = await Promise.all([56		makeDir('unicorn/rainbow'),57		makeDir('foo/bar')58	]);59 60	console.log(paths);61	/*62	[63		'/Users/sindresorhus/fun/unicorn/rainbow',64		'/Users/sindresorhus/fun/foo/bar'65	]66	*/67})();68```69 70## API71 72### makeDir(path, options?)73 74Returns a `Promise` for the path to the created directory.75 76### makeDir.sync(path, options?)77 78Returns the path to the created directory.79 80#### path81 82Type: `string`83 84Directory to create.85 86#### options87 88Type: `object`89 90##### mode91 92Type: `integer`\93Default: `0o777`94 95Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/).96 97##### fs98 99Type: `object`\100Default: `require('fs')`101 102Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs).103 104Using a custom `fs` implementation will block the use of the native `recursive` option if `fs.mkdir` or `fs.mkdirSync` is not the native function.105 106## Related107 108- [make-dir-cli](https://github.com/sindresorhus/make-dir-cli) - CLI for this module109- [del](https://github.com/sindresorhus/del) - Delete files and directories110- [globby](https://github.com/sindresorhus/globby) - User-friendly glob matching111- [cpy](https://github.com/sindresorhus/cpy) - Copy files112- [cpy-cli](https://github.com/sindresorhus/cpy-cli) - Copy files on the command-line113- [move-file](https://github.com/sindresorhus/move-file) - Move a file114 115---116 117<div align="center">118	<b>119		<a href="https://tidelift.com/subscription/pkg/npm-make-dir?utm_source=npm-make-dir&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>120	</b>121	<br>122	<sub>123		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.124	</sub>125</div>126 
basant307/AI_Governance_Project · CoolFace