Skip to content

Commit c13e5be

Browse files
Trotttargos
authored andcommitted
net: use decodeStrings public API for writable stream
Instead of using an undocumented underscore-prefixed property to configure the writable stream instance to not encode strings as buffers, use the public API which is an options property passed to the constructor. Refs: #445 PR-URL: #25201 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 9ac8d41 commit c13e5be

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/net.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ function Socket(options) {
255255
options.allowHalfOpen = true;
256256
// For backwards compat do not emit close on destroy.
257257
options.emitClose = false;
258+
// Handle strings directly.
259+
options.decodeStrings = false;
258260
stream.Duplex.call(this, options);
259261

260262
// Default to *not* allowing half open sockets.
@@ -308,9 +310,6 @@ function Socket(options) {
308310
this._pendingData = null;
309311
this._pendingEncoding = '';
310312

311-
// handle strings directly
312-
this._writableState.decodeStrings = false;
313-
314313
// If we have a handle, then start the flow of data into the
315314
// buffer. if not, then this will happen when we connect
316315
if (this._handle && options.readable !== false) {

0 commit comments

Comments
 (0)