Lines Matching refs:stream

77 function WritableState(options, stream, isDuplex) {
81 // values for the readable and the writable sides of the duplex stream,
84 isDuplex = stream instanceof Stream.Duplex;
86 // Object stream flag to indicate whether or not this stream
150 this.onwrite = onwrite.bind(undefined, stream);
187 // Indicates whether the stream has errored. When true all write() calls
189 // is disabled we need a way to tell whether the stream has failed.
192 // Indicates whether the stream has finished destroying.
286 function _write(stream, chunk, encoding, cb) {
287 const state = stream._writableState;
329 errorOrDestroy(stream, err, true);
333 return writeOrBuffer(stream, state, chunk, encoding, cb);
368 function writeOrBuffer(stream, state, chunk, encoding, callback) {
373 // stream._write resets state.length
392 stream._write(chunk, encoding, state.onwrite);
397 // any synchronous while(stream.write(data)) loops.
401 function doWrite(stream, state, writev, len, chunk, encoding, cb) {
409 stream._writev(chunk, state.onwrite);
411 stream._write(chunk, encoding, state.onwrite);
415 function onwriteError(stream, state, er, cb) {
425 errorOrDestroy(stream, er);
428 function onwrite(stream, er) {
429 const state = stream._writableState;
434 errorOrDestroy(stream, new ERR_MULTIPLE_CALLBACK());
453 if (stream._readableState && !stream._readableState.errored) {
454 stream._readableState.errored = er;
458 process.nextTick(onwriteError, stream, state, er, cb);
460 onwriteError(stream, state, er, cb);
464 clearBuffer(stream, state);
476 state.afterWriteTickInfo = { count: 1, cb, stream, state };
480 afterWrite(stream, state, 1, cb);
485 function afterWriteTick({ stream, state, count, cb }) {
487 return afterWrite(stream, state, count, cb);
490 function afterWrite(stream, state, count, cb) {
491 const needDrain = !state.ending && !stream.destroyed && state.length === 0 &&
495 stream.emit('drain');
507 finishMaybe(stream, state);
532 function clearBuffer(stream, state) {
550 if (bufferedLength > 1 && stream._writev) {
564 doWrite(stream, state, true, state.length, chunks, '', callback);
572 doWrite(stream, state, false, len, chunk, encoding, callback);
666 function callFinal(stream, state) {
671 errorOrDestroy(stream, err ?? ERR_MULTIPLE_CALLBACK());
682 errorOrDestroy(stream, err, state.sync);
685 stream.emit('prefinish');
690 process.nextTick(finish, stream, state);
698 stream._final(onFinish);
706 function prefinish(stream, state) {
708 if (typeof stream._final === 'function' && !state.destroyed) {
710 callFinal(stream, state);
713 stream.emit('prefinish');
718 function finishMaybe(stream, state, sync) {
720 prefinish(stream, state);
724 process.nextTick((stream, state) => {
726 finish(stream, state);
730 }, stream, state);
733 finish(stream, state);
739 function finish(stream, state) {
748 stream.emit('finish');
753 const rState = stream._readableState;
761 stream.destroy();
792 // w.writable === false means that this is part of a Duplex stream