GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — stream: avoid getter for defaultEncoding · nodejs/node@b338f3d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/streams
    • writable.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/streams/writable.js‎

Copy file name to clipboardExpand all lines: lib/internal/streams/writable.js
+9-8Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -445,16 +445,17 @@ function _write(stream, chunk, encoding, cb) {
445445

446446
if (typeof encoding === 'function') {
447447
cb = encoding;
448-
encoding = (state[kState] & kDefaultUTF8Encoding) !== 0 ? 'utf8' : state.defaultEncoding;
449-
} else {
450-
if (!encoding)
451-
encoding = (state[kState] & kDefaultUTF8Encoding) !== 0 ? 'utf8' : state.defaultEncoding;
452-
else if (encoding !== 'buffer' && !Buffer.isEncoding(encoding))
453-
throw new ERR_UNKNOWN_ENCODING(encoding);
454-
if (typeof cb !== 'function')
455-
cb = nop;
448+
encoding = null;
456449
}
457450

451+
if (!encoding)
452+
encoding = (state[kState] & kDefaultUTF8Encoding) !== 0 ? 'utf8' : state[kDefaultEncodingValue];
453+
else if (encoding !== 'buffer' && !Buffer.isEncoding(encoding))
454+
throw new ERR_UNKNOWN_ENCODING(encoding);
455+
456+
if (cb == null || typeof cb !== 'function')
457+
cb = nop;
458+
458459
if (chunk === null) {
459460
throw new ERR_STREAM_NULL_VALUES();
460461
} else if ((state[kState] & kObjectMode) === 0) {

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.