Skip to content

Commit 2335467

Browse files
LiviaMedeirosbengl
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 69a3792 commit 2335467

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

3101+
### DEP0162: `fs.write()`, `fs.writeFileSync()` coercion to string
3102+
3103+
<!-- YAML
3104+
changes:
3105+
- version: REPLACEME
3106+
pr-url: https://github.com/nodejs/node/pull/42149
3107+
description: Documentation-only deprecation.
3108+
-->
3109+
3110+
Type: Documentation-only
3111+
3112+
Implicit coercion of objects with own `toString` property, passed as second
3113+
parameter in [`fs.write()`][], [`fs.writeFile()`][], [`fs.appendFile()`][],
3114+
[`fs.writeFileSync()`][], and [`fs.appendFileSync()`][] is deprecated.
3115+
Convert them to primitive strings.
3116+
31013117
[Legacy URL API]: url.md#legacy-url-api
31023118
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
31033119
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
@@ -3146,6 +3162,8 @@ resources and not the actual references.
31463162
[`events.listenerCount(emitter, eventName)`]: events.md#eventslistenercountemitter-eventname
31473163
[`fs.FileHandle`]: fs.md#class-filehandle
31483164
[`fs.access()`]: fs.md#fsaccesspath-mode-callback
3165+
[`fs.appendFile()`]: fs.md#fsappendfilepath-data-options-callback
3166+
[`fs.appendFileSync()`]: fs.md#fsappendfilesyncpath-data-options
31493167
[`fs.createReadStream()`]: fs.md#fscreatereadstreampath-options
31503168
[`fs.createWriteStream()`]: fs.md#fscreatewritestreampath-options
31513169
[`fs.exists(path, callback)`]: fs.md#fsexistspath-callback
@@ -3156,6 +3174,9 @@ resources and not the actual references.
31563174
[`fs.read()`]: fs.md#fsreadfd-buffer-offset-length-position-callback
31573175
[`fs.readSync()`]: fs.md#fsreadsyncfd-buffer-offset-length-position
31583176
[`fs.stat()`]: fs.md#fsstatpath-options-callback
3177+
[`fs.write()`]: fs.md#fswritefd-buffer-offset-length-position-callback
3178+
[`fs.writeFile()`]: fs.md#fswritefilefile-data-options-callback
3179+
[`fs.writeFileSync()`]: fs.md#fswritefilesyncfile-data-options
31593180
[`http.ClientRequest`]: http.md#class-httpclientrequest
31603181
[`http.IncomingMessage`]: http.md#class-httpincomingmessage
31613182
[`http.ServerResponse`]: http.md#class-httpserverresponse

0 commit comments

Comments
 (0)