Skip to content
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

doc: clarify mkdir() recursive behavior #48109

Merged
merged 6 commits into from
May 24, 2023

Conversation

Stevepurpose
Copy link
Contributor

No description provided.

@Stevepurpose
Copy link
Contributor Author

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.

doc/api/fs.md Outdated Show resolved Hide resolved
@Trott Trott 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
doc/api/fs.md Outdated
Comment on lines 3214 to 3216
//Note the relative path to `tmp` below ,otherwise path won't be created in our project.

mkdir('./tmp/a/apple', { recursive: true }, (err) => {
Copy link
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
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
Contributor Author

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?

doc/api/fs.md Outdated Show resolved Hide resolved
doc/api/fs.md Outdated Show resolved Hide resolved
@Trott Trott changed the title Node source doc: clarify mkdir() recursive behavior May 22, 2023
@marco-ippolito marco-ippolito added the doc Issues and PRs related to the documentations. label May 22, 2023
Stevepurpose and 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>
@Trott Trott closed this May 22, 2023
@Trott Trott reopened this May 22, 2023
doc/api/fs.md Outdated Show resolved Hide resolved
@Trott Trott added the commit-queue Add this label to land a pull request using GitHub Actions. label May 24, 2023
@nodejs-github-bot nodejs-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:main May 24, 2023
17 checks passed
@nodejs-github-bot
Copy link
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>
@targos targos mentioned this pull request Jun 4, 2023
@Mesteery Mesteery 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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants