You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Documentation should mention encoding instead of defaultEncoding as options property for fs.createWriteStream #14611
docIssues and PRs related to Node.js documentation.fsIssues and PRs related to file-system APIs and the fs module.good first issueIssues that are suitable for first-time contributors.streamIssues and PRs related to Node.js streams.
Documentation says that defaultEncoding is the right options property for fs.createWriteStream. But if we look into source code [1] options are directly passed to WriteStream that expects options.encoding [2]. At the same time options are passed to Writable->WritableState [3] that expects options.defaultEncoding instead [4].
For example this inconsistency reveals when you pass "wrong" encoding. Both following examples throw TypeError: Unknown encoding: unknown:
docIssues and PRs related to Node.js documentation.fsIssues and PRs related to file-system APIs and the fs module.good first issueIssues that are suitable for first-time contributors.streamIssues and PRs related to Node.js streams.
Type
No type
Projects
No projects
Milestone
No milestone
Relationships
None yet
Development
No branches or pull requests
Issue actions
You can’t perform that action at this time.
✕
Wait! Don't Go Yet 🚀
Get our FREE eBook "10 Programming Tips That Changed Everything" when you subscribe!
Activity
MylesBorins commentedon Aug 11, 2017
/cc @nodejs/streams @mcollina
mcollina commentedon Aug 16, 2017
I would say we should update the docs to use
'encoding'instead. @azasypkin would you like to send a PR?azasypkin commentedon Aug 16, 2017
Sure, but will go through
CONTRIBUTING.mdfirst. Should the fix go tomasteronly or PRs for 6/7/8 will be needed too?And I'm going to update TS type definitions too (I see it has been noticed already DefinitelyTyped/DefinitelyTyped#14981).
mcollina commentedon Aug 16, 2017
the fix will go to master, and then we will backport to 8 and 6.
doc,fs: rename defaultEncoding option to encoding
doc,fs: rename defaultEncoding option to encoding
doc,fs: rename defaultEncoding option to encoding