Repository navigation
doc: add fspromises mkdir example #40843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
7a4a320
9fcb48e
38ed2f2
90e60a2
d63bc20
f0c22f3
7bc43d8
775fb38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Signed-off-by: Tierney Cyren <hello@bnb.im>
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1014,7 +1014,7 @@ try { | |
| const path = new URL('./test/project', import.meta.url); | ||
| const createDir = await mkdir(path, { recursive: true }); | ||
|
|
||
| console.log (`created ${createDir}`); | ||
| console.log(`created ${createDir}`); | ||
| } catch (err) { | ||
| console.error(err.message); | ||
| } | ||
|
|
@@ -1024,16 +1024,22 @@ try { | |
| const { mkdir } = require('fs/promises'); | ||
| const { resolve } = require('path'); | ||
|
|
||
| async function makeDirectory () { | ||
| const path = resolve('./test/project/lol/hi') | ||
| const dirCreation = await mkdir(path, { recursive: true }); | ||
|
|
||
| console.log(dirCreation) | ||
| return dirCreation; | ||
| async function makeDirectory() { | ||
| try { | ||
| const path = resolve('./test/project/lol/hi'); | ||
|
bnb marked this conversation as resolved.
Outdated
|
||
| const dirCreation = await mkdir(path, { recursive: true }); | ||
|
|
||
| console.log(dirCreation); | ||
| return dirCreation; | ||
| } catch (err) { | ||
| console.error(err.message); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| makeDirectory(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: instead of a try/catch, I would put a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would you want me to move the MJS example to be a function and do the same, or should that continue using top-level await in a try/catch? |
||
| ``` | ||
|
|
||
| ### `fsPromises.mkdtemp(prefix[, options])` | ||
|
|
||
| <!-- YAML | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.