GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Using "folder" and "directory" interchangeably in documentation · Issue #32902 · nodejs/node

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

New issue
Copy link
New issue
Copy link
Closed
Closed
Using "folder" and "directory" interchangeably in documentation#32902
Copy link
Labels
docIssues and PRs related to Node.js documentation.good first issueIssues that are suitable for first-time contributors.questionIssues asking questions about Node.js.

Description

@basickarl
basickarl
opened on Apr 17, 2020
Issue body actions

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.
});

Activity

  1. himself65
    added
    questionIssues asking questions about Node.js.
    on Apr 17, 2020
  2. cjihrig commented on Apr 17, 2020

    @cjihrig
    cjihrig
    on Apr 17, 2020
    Contributor
    More actions

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

  3. bnoordhuis commented on Apr 17, 2020

    @bnoordhuis
    bnoordhuis
    on Apr 17, 2020
    Member
    More actions

    It should just be directory everywhere.

  4. bnoordhuis
    added
    docIssues and PRs related to Node.js documentation.
    good first issueIssues that are suitable for first-time contributors.
    on Apr 17, 2020
  5. manisaiprasad commented on Apr 17, 2020

    @manisaiprasad
    manisaiprasad
    on Apr 17, 2020
    More actions

    Can I take this issue?

    Reacted by Juan José
  6. karan1205
    added a commit that references this issue on Apr 18, 2020

    doc: fix usage of folder and directory terms in fs.md

    2f106c1
  7. puzpuzpuz
    closed this as completedin b53cae3on Apr 21, 2020
  8. BethGriggs
    added a commit that references this issue on Apr 27, 2020

    doc: fix usage of folder and directory terms in fs.md

    68b7c80
  9. BridgeAR
    added a commit that references this issue on Apr 28, 2020

    doc: fix usage of folder and directory terms in fs.md

    76e960c
  10. targos
    added a commit that references this issue on Apr 30, 2020

    doc: fix usage of folder and directory terms in fs.md

    ee9d25b
  11. targos
    added a commit that references this issue on May 13, 2020

    doc: fix usage of folder and directory terms in fs.md

    26cf6a3
  12. sjarmak
    added a commit that references this issue on Jul 27, 2026

    doc: fix usage of folder and directory terms in fs.md

    b53cae3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to Node.js documentation.good first issueIssues that are suitable for first-time contributors.questionIssues asking questions about Node.js.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.