Skip to content

Commit 1497aa4

Browse files
LiviaMedeirosdanielleadams
authored andcommitted
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 fcee827 commit 1497aa4

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
@@ -3085,6 +3085,22 @@ releases.
30853085
Use [`process.getActiveResourcesInfo()`][] to get a list of types of active
30863086
resources and not the actual references.
30873087

3088+
### DEP0162: `fs.write()`, `fs.writeFileSync()` coercion to string
3089+
3090+
<!-- YAML
3091+
changes:
3092+
- version: REPLACEME
3093+
pr-url: https://github.com/nodejs/node/pull/42149
3094+
description: Documentation-only deprecation.
3095+
-->
3096+
3097+
Type: Documentation-only
3098+
3099+
Implicit coercion of objects with own `toString` property, passed as second
3100+
parameter in [`fs.write()`][], [`fs.writeFile()`][], [`fs.appendFile()`][],
3101+
[`fs.writeFileSync()`][], and [`fs.appendFileSync()`][] is deprecated.
3102+
Convert them to primitive strings.
3103+
30883104
[Legacy URL API]: url.md#legacy-url-api
30893105
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
30903106
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
@@ -3133,6 +3149,8 @@ resources and not the actual references.
31333149
[`events.listenerCount(emitter, eventName)`]: events.md#eventslistenercountemitter-eventname
31343150
[`fs.FileHandle`]: fs.md#class-filehandle
31353151
[`fs.access()`]: fs.md#fsaccesspath-mode-callback
3152+
[`fs.appendFile()`]: fs.md#fsappendfilepath-data-options-callback
3153+
[`fs.appendFileSync()`]: fs.md#fsappendfilesyncpath-data-options
31363154
[`fs.createReadStream()`]: fs.md#fscreatereadstreampath-options
31373155
[`fs.createWriteStream()`]: fs.md#fscreatewritestreampath-options
31383156
[`fs.exists(path, callback)`]: fs.md#fsexistspath-callback
@@ -3143,6 +3161,9 @@ resources and not the actual references.
31433161
[`fs.read()`]: fs.md#fsreadfd-buffer-offset-length-position-callback
31443162
[`fs.readSync()`]: fs.md#fsreadsyncfd-buffer-offset-length-position
31453163
[`fs.stat()`]: fs.md#fsstatpath-options-callback
3164+
[`fs.write()`]: fs.md#fswritefd-buffer-offset-length-position-callback
3165+
[`fs.writeFile()`]: fs.md#fswritefilefile-data-options-callback
3166+
[`fs.writeFileSync()`]: fs.md#fswritefilesyncfile-data-options
31463167
[`http.ClientRequest`]: http.md#class-httpclientrequest
31473168
[`http.IncomingMessage`]: http.md#class-httpincomingmessage
31483169
[`http.ServerResponse`]: http.md#class-httpserverresponse

0 commit comments

Comments
 (0)