| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -323,7 +323,7 @@ Writable.prototype.write = function(chunk, encoding, cb) { | |||
| 323 | 323 | errorOrDestroy(this, err); | |
| 324 | 324 | } else if (isBuf || validChunk(this, state, chunk, cb)) { | |
| 325 | 325 | state.pendingcb++; | |
| 326 | - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); | ||
| 326 | + ret = writeOrBuffer(this, state, chunk, encoding, cb); | ||
| 327 | 327 | } | |
| 328 | 328 | ||
| 329 | 329 | return ret; | |
@@ -367,15 +367,6 @@ ObjectDefineProperty(Writable.prototype, 'writableBuffer', { | |||
| 367 | 367 | } | |
| 368 | 368 | }); | |
| 369 | 369 | ||
| 370 | - function decodeChunk(state, chunk, encoding) { | ||
| 371 | - if (!state.objectMode && | ||
| 372 | - state.decodeStrings !== false && | ||
| 373 | - typeof chunk === 'string') { | ||
| 374 | - chunk = Buffer.from(chunk, encoding); | ||
| 375 | - } | ||
| 376 | - return chunk; | ||
| 377 | - } | ||
| 378 | - | ||
| 379 | 370 | ObjectDefineProperty(Writable.prototype, 'writableEnded', { | |
| 380 | 371 | // Making it explicit this property is not enumerable | |
| 381 | 372 | // because otherwise some prototype manipulation in | |
@@ -409,14 +400,13 @@ ObjectDefineProperty(Writable.prototype, 'writableCorked', { | |||
| 409 | 400 | // If we're already writing something, then just put this | |
| 410 | 401 | // in the queue, and wait our turn. Otherwise, call _write | |
| 411 | 402 | // If we return false, then we need a drain event, so set that flag. | |
| 412 | - function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { | ||
| 413 | - if (!isBuf) { | ||
| 414 | - var newChunk = decodeChunk(state, chunk, encoding); | ||
| 415 | - if (chunk !== newChunk) { | ||
| 416 | - isBuf = true; | ||
| 417 | - encoding = 'buffer'; | ||
| 418 | - chunk = newChunk; | ||
| 419 | - } | ||
| 403 | + function writeOrBuffer(stream, state, chunk, encoding, cb) { | ||
| 404 | + if (!state.objectMode && | ||
| 405 | + state.decodeStrings !== false && | ||
| 406 | + encoding !== 'buffer' && | ||
| 407 | + typeof chunk === 'string') { | ||
| 408 | + chunk = Buffer.from(chunk, encoding); | ||
| 409 | + encoding = 'buffer'; | ||
| 420 | 410 | } | |
| 421 | 411 | const len = state.objectMode ? 1 : chunk.length; | |
| 422 | 412 | ||
@@ -432,7 +422,6 @@ function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { | |||
| 432 | 422 | state.lastBufferedRequest = { | |
| 433 | 423 | chunk, | |
| 434 | 424 | encoding, | |
| 435 | - isBuf, | ||
| 436 | 425 | callback: cb, | |
| 437 | 426 | next: null | |
| 438 | 427 | }; | |
@@ -559,7 +548,7 @@ function clearBuffer(stream, state) { | |||
| 559 | 548 | var allBuffers = true; | |
| 560 | 549 | while (entry) { | |
| 561 | 550 | buffer[count] = entry; | |
| 562 | - if (!entry.isBuf) | ||
| 551 | + if (entry.encoding !== 'buffer') | ||
| 563 | 552 | allBuffers = false; | |
| 564 | 553 | entry = entry.next; | |
| 565 | 554 | count += 1; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments