File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -982,6 +982,34 @@ property indicating whether parent directories should be created. Calling
982
982
` fsPromises .mkdir ()` when ` path` is a directory that exists results in a
983
983
rejection only when ` recursive` is false.
984
984
985
+ ` ` ` mjs
986
+ import { mkdir } from ' node:fs/promises' ;
987
+
988
+ try {
989
+ const projectFolder = new URL (' ./test/project/' , import .meta.url);
990
+ const createDir = await mkdir (path, { recursive: true });
991
+
992
+ console .log (` created ${ createDir} ` );
993
+ } catch (err) {
994
+ console .error (err .message );
995
+ }
996
+ ` ` `
997
+
998
+ ` ` ` cjs
999
+ const { mkdir } = require (' node:fs/promises' );
1000
+ const { resolve , join } = require (' node:path' );
1001
+
1002
+ async function makeDirectory () {
1003
+ const projectFolder = join (__dirname , ' test' , ' project' );
1004
+ const dirCreation = await mkdir (projectFolder, { recursive: true });
1005
+
1006
+ console .log (dirCreation);
1007
+ return dirCreation;
1008
+ }
1009
+
1010
+ makeDirectory ().catch (console .error );
1011
+ ` ` `
1012
+
985
1013
### ` fsPromises .mkdtemp (prefix[, options])`
986
1014
987
1015
<!-- YAML
You can’t perform that action at this time.
0 commit comments