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: fix param type of fs.write #41882

Closed
wants to merge 1 commit into from
Closed

Conversation

kt3k
Copy link
Contributor

@kt3k kt3k commented Feb 7, 2022

6-arg version of fs.write doesn't support string as the 2nd arg,
and similarly 5-arg version fs.writeSync doesn't support string
as the 2nd arg. This change removes those unsupported types from
the API docs.

(string type is supported for 5-arg version of fs.write, and 4-arg version of fs.writeSync and those are covered by the next entries)

Examples to support the above claim:

fs.write(process.stdout.fd, Buffer.from([0x61]), 0, 1, null, () => {});
// => prints 'a'
fs.write(process.stdout.fd, "a", 0, 1, null, () => {});
// => throws ERR_INVALID_CALLBACK

6-arg version of `fs.write` doesn't support string as the 2nd arg,
and similarly 5-arg version `fs.writeSync` doesn't support string
as the 2nd arg. This change removes those unsupported types from
the API docs.
@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system. labels Feb 7, 2022
@Ayase-252
Copy link
Member

Should we consider it as a bug?

@kt3k
Copy link
Contributor Author

kt3k commented Feb 7, 2022

Should we consider it as a bug?

We can't specify the encoding of the string with 6-arg version of fs.write. So it doesn't make sense to support string for the 2nd arg in my view

@aduh95
Copy link
Contributor

aduh95 commented Feb 7, 2022

I think it's being addressed by #41677?

@kt3k
Copy link
Contributor Author

kt3k commented Feb 8, 2022

@aduh95 Right. #41677 includes this change. Closing this one for now

@kt3k kt3k closed this Feb 8, 2022
@kt3k kt3k deleted the docs/fix-fs-write branch February 8, 2022 02:46
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. fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants