Skip to content

Commit 2d6ee5a

Browse files
committed
doc: deprecate string coercion in fs.write, fs.writeFile, fs.appendFile
Refs: #41677
1 parent b3723fa commit 2d6ee5a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

doc/api/deprecations.md

+18
Original file line numberDiff line numberDiff line change
@@ -3110,6 +3110,21 @@ releases.
31103110
Use [`process.getActiveResourcesInfo()`][] to get a list of types of active
31113111
resources and not the actual references.
31123112

3113+
### DEP0162: `fs.write`, `fs.writeFile`, `fs.appendFile` coercion to string
3114+
3115+
<!-- YAML
3116+
changes:
3117+
- version: REPLACEME
3118+
pr-url: https://github.com/nodejs/node/pull/42149
3119+
description: Documentation-only deprecation.
3120+
-->
3121+
3122+
Type: Documentation-only
3123+
3124+
Implicit coercion of objects with own `toString` property, passed as second
3125+
parameter in [`fs.write()`][], [`fs.writeFile()`][] and [`fs.appendFile()`][],
3126+
is deprecated. Convert them to primitive strings.
3127+
31133128
[Legacy URL API]: url.md#legacy-url-api
31143129
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
31153130
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
@@ -3158,6 +3173,7 @@ resources and not the actual references.
31583173
[`events.listenerCount(emitter, eventName)`]: events.md#eventslistenercountemitter-eventname
31593174
[`fs.FileHandle`]: fs.md#class-filehandle
31603175
[`fs.access()`]: fs.md#fsaccesspath-mode-callback
3176+
[`fs.appendFile()`]: fs.md#fsappendfilepath-data-options-callback
31613177
[`fs.createReadStream()`]: fs.md#fscreatereadstreampath-options
31623178
[`fs.createWriteStream()`]: fs.md#fscreatewritestreampath-options
31633179
[`fs.exists(path, callback)`]: fs.md#fsexistspath-callback
@@ -3168,6 +3184,8 @@ resources and not the actual references.
31683184
[`fs.read()`]: fs.md#fsreadfd-buffer-offset-length-position-callback
31693185
[`fs.readSync()`]: fs.md#fsreadsyncfd-buffer-offset-length-position
31703186
[`fs.stat()`]: fs.md#fsstatpath-options-callback
3187+
[`fs.write()`]: fs.md#fswritefd-buffer-offset-length-position-callback
3188+
[`fs.writeFile()`]: fs.md#fswritefilefile-data-options-callback
31713189
[`http.ClientRequest`]: http.md#class-httpclientrequest
31723190
[`http.IncomingMessage`]: http.md#class-httpincomingmessage
31733191
[`http.ServerResponse`]: http.md#class-httpserverresponse

0 commit comments

Comments
 (0)