nodejs / nodejs/node

doc: Clarify what <string> means in path option of fs.readFile, fs.readFileSync etc.

Open
#36,585 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

doc fs question
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

  • Version: 14.15.3 x64
  • Platform: Windows 10 64-bit
  • Subsystem: fs

Affected URL(s):
https://nodejs.org/dist/latest-v14.x/docs/api/fs.html#fs_fs_readfile_path_options
https://nodejs.org/dist/latest-v14.x/docs/api/fs.html#fs_fs_readfilesync_path_options

Description

I am not sure if this a documentation issue or a bug. I get a ENOENT error when I use a url string as path for fs.readFile. However, if I convert the url string to a file path, I am able to read the file.

It needs to be clarified if path strings are exclusively file paths and not urls. If it can also be a url string (and I see no reason for not supporting them?) , then this is bug/feature request!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the affected fs.readFile and fs.readFileSync path-option documentation URLs. Check how the documentation currently describes string paths and clarify whether they refer only to file paths or also URLs, with the wording consistent across both sections.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.