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

Using "folder" and "directory" interchangeably in documentation #32902

Closed
basickarl opened this issue Apr 17, 2020 · 3 comments
Closed

Using "folder" and "directory" interchangeably in documentation #32902

basickarl opened this issue Apr 17, 2020 · 3 comments
Labels
doc Issues and PRs related to the documentations. good first issue Issues that are suitable for first-time contributors. question Issues that look for answers.

Comments

@basickarl
Copy link

https://nodejs.org/api/fs.html

I'm reading this and it seems like Node documentation like to mix the terms "folder" and "directory" interchangeably.

I'm wondering, why is Node mixing these concepts, they are not the same thing.

https://nodejs.org/api/fs.html#fs_fs_mkdtemp_prefix_options_callback

Quote:

History
prefix
options |

encoding Default: 'utf8'
callback

err
folder
Creates a unique temporary directory.

Generates six random characters to be appended behind a required prefix to create a unique temporary directory. Due to platform inconsistencies, avoid trailing X characters in prefix. Some platforms, notably the BSDs, can return more than six random characters, and replace trailing X characters in prefix with random characters.

The created folder path is passed as a string to the callback's second parameter.

The optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use.

fs.mkdtemp(path.join(os.tmpdir(), 'foo-'), (err, folder) => {
if (err) throw err;
console.log(folder);
// Prints: /tmp/foo-itXde2 or C:\Users...\AppData\Local\Temp\foo-itXde2
});
The fs.mkdtemp() method will append the six randomly selected characters directly to the prefix string. For instance, given a directory /tmp, if the intention is to create a temporary directory within /tmp, the prefix must end with a trailing platform-specific path separator (require('path').sep).

// The parent directory for the new temporary directory
const tmpDir = os.tmpdir();

// This method is INCORRECT:
fs.mkdtemp(tmpDir, (err, folder) => {
if (err) throw err;
console.log(folder);
// Will print something similar to /tmpabc123.
// A new temporary directory is created at the file system root
// rather than within the /tmp directory.
});

// This method is CORRECT:
const { sep } = require('path');
fs.mkdtemp(${tmpDir}${sep}, (err, folder) => {
if (err) throw err;
console.log(folder);
// Will print something similar to /tmp/abc123.
// A new temporary directory is created within
// the /tmp directory.
});

@himself65 himself65 added the question Issues that look for answers. label Apr 17, 2020
@cjihrig
Copy link
Contributor

cjihrig commented Apr 17, 2020

@basickarl PRs that improve the docs are always welcome. Would you like to help?

@bnoordhuis
Copy link
Member

It should just be directory everywhere.

@bnoordhuis bnoordhuis added doc Issues and PRs related to the documentations. good first issue Issues that are suitable for first-time contributors. labels Apr 17, 2020
@manisaiprasad
Copy link

Can I take this issue?

karan1205 added a commit to karan1205/node that referenced this issue Apr 18, 2020
This commit fixes the interchangeably usage of "folder" and "directory"
terms in fs.md

Fixes: nodejs#32902
BethGriggs pushed a commit that referenced this issue Apr 27, 2020
This commit fixes the interchangeably usage of "folder" and "directory"
terms in fs.md

Fixes: #32902

PR-URL: #32919
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Andrey Pechkurov <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Zeyu Yang <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
BridgeAR pushed a commit that referenced this issue Apr 28, 2020
This commit fixes the interchangeably usage of "folder" and "directory"
terms in fs.md

Fixes: #32902

PR-URL: #32919
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Andrey Pechkurov <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Zeyu Yang <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
targos pushed a commit that referenced this issue Apr 30, 2020
This commit fixes the interchangeably usage of "folder" and "directory"
terms in fs.md

Fixes: #32902

PR-URL: #32919
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Andrey Pechkurov <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Zeyu Yang <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
targos pushed a commit that referenced this issue May 13, 2020
This commit fixes the interchangeably usage of "folder" and "directory"
terms in fs.md

Fixes: #32902

PR-URL: #32919
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Andrey Pechkurov <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Zeyu Yang <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. good first issue Issues that are suitable for first-time contributors. question Issues that look for answers.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants