Skip to content

doc: clarify mkdir() recursive behavior - #48109

Merged
nodejs-github-bot merged 6 commits into
nodejs:mainfrom
Stevepurpose:nodeSource
May 24, 2023
Merged

doc: clarify mkdir() recursive behavior#48109
nodejs-github-bot merged 6 commits into
nodejs:mainfrom
Stevepurpose:nodeSource

Conversation

@Stevepurpose

Copy link
Copy Markdown
Contributor

No description provided.

@Stevepurpose

Copy link
Copy Markdown
ContributorAuthor

I had to add some more practical explanation to a few lines and also noticed a piece of code wasn't working the way it was described as ,noticed code only worked with a relative path and also commented the code after adding a relative path.

Comment threaddoc/api/fs.md Outdated
@TrottTrott added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label May 22, 2023
Comment threaddoc/api/fs.md Outdated
Comment on lines 3214 to 3216

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//Note the relative path to `tmp` below ,otherwise path won't be created in our project.
mkdir('./tmp/a/apple', { recursive: true }, (err) => {
// Create ./tmp/a/apple, regardless of whether ./tmp and ./tmp/a exist.
mkdir('./tmp/a/apple', { recursive: true }, (err) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(The code should work fine with an absolute path instead of a relative path, but there are security implications to creating directories in /tmp with predictable names that aren't accounted for in the example code. It shouldn't ignore if someone else has already created the directory with permissions different than expected or with pre-existing contents. So I think it's good to switch it to a relative directory like you've done here or else some other absolute directory.)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I have a better explanation to the whole behaviour of the code above ,can I go ahead and fix it?

Comment threaddoc/api/fs.md Outdated
Comment threaddoc/api/fs.md Outdated
@TrottTrott changed the title Node sourcedoc: clarify mkdir() recursive behaviorMay 22, 2023
@marco-ippolitomarco-ippolito added the doc Issues and PRs related to the documentations. label May 22, 2023
Stevepurposeand others added 4 commits May 22, 2023 15:40
Co-authored-by: Rich Trott <rtrott@gmail.com>
Co-authored-by: Rich Trott <rtrott@gmail.com>
@TrottTrott closed this May 22, 2023
@TrottTrott reopened this May 22, 2023
Comment threaddoc/api/fs.md Outdated
@TrottTrott added the commit-queue Add this label to land a pull request using GitHub Actions. label May 24, 2023
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label May 24, 2023
@nodejs-github-bot
nodejs-github-bot merged commit 6599cfe into nodejs:mainMay 24, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 6599cfe

targos pushed a commit that referenced this pull request May 30, 2023
PR-URL: #48109
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@targostargos mentioned this pull request Jun 4, 2023
@MesteeryMesteery mentioned this pull request Jun 7, 2023
danielleadams pushed a commit that referenced this pull request Jul 6, 2023
PR-URL: #48109
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
MoLow pushed a commit to MoLow/node that referenced this pull request Jul 6, 2023
PR-URL: nodejs#48109
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
PR-URL: nodejs#48109
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
PR-URL: nodejs#48109
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit-queue-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.docIssues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@Stevepurpose@nodejs-github-bot@Trott@lpinca@aymen94@marco-ippolito