Skip to content

Commit 4b198ff

Browse files
doc: deprecate string coercion in fs.write, fs.writeFileSync
This also affects `fs.writeFile`, `fs.appendFile`, and `fs.appendFileSync` Refs: #41677 PR-URL: #42149 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 409c594 commit 4b198ff

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

doc/api/deprecations.md

+21
Original file line numberDiff line numberDiff line change
@@ -3110,6 +3110,22 @@ 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.writeFileSync()` 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()`][], [`fs.appendFile()`][],
3126+
[`fs.writeFileSync()`][], and [`fs.appendFileSync()`][] is deprecated.
3127+
Convert them to primitive strings.
3128+
31133129
[Legacy URL API]: url.md#legacy-url-api
31143130
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
31153131
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
@@ -3158,6 +3174,8 @@ resources and not the actual references.
31583174
[`events.listenerCount(emitter, eventName)`]: events.md#eventslistenercountemitter-eventname
31593175
[`fs.FileHandle`]: fs.md#class-filehandle
31603176
[`fs.access()`]: fs.md#fsaccesspath-mode-callback
3177+
[`fs.appendFile()`]: fs.md#fsappendfilepath-data-options-callback
3178+
[`fs.appendFileSync()`]: fs.md#fsappendfilesyncpath-data-options
31613179
[`fs.createReadStream()`]: fs.md#fscreatereadstreampath-options
31623180
[`fs.createWriteStream()`]: fs.md#fscreatewritestreampath-options
31633181
[`fs.exists(path, callback)`]: fs.md#fsexistspath-callback
@@ -3168,6 +3186,9 @@ resources and not the actual references.
31683186
[`fs.read()`]: fs.md#fsreadfd-buffer-offset-length-position-callback
31693187
[`fs.readSync()`]: fs.md#fsreadsyncfd-buffer-offset-length-position
31703188
[`fs.stat()`]: fs.md#fsstatpath-options-callback
3189+
[`fs.write()`]: fs.md#fswritefd-buffer-offset-length-position-callback
3190+
[`fs.writeFile()`]: fs.md#fswritefilefile-data-options-callback
3191+
[`fs.writeFileSync()`]: fs.md#fswritefilesyncfile-data-options
31713192
[`http.ClientRequest`]: http.md#class-httpclientrequest
31723193
[`http.IncomingMessage`]: http.md#class-httpincomingmessage
31733194
[`http.ServerResponse`]: http.md#class-httpserverresponse

0 commit comments

Comments
 (0)