MCPcopy Index your code
hub / github.com/nodejs/node / #flushBuffer

Method #flushBuffer

lib/internal/streams/fast-utf8-stream.js:732–764  ·  view source on GitHub ↗
(cb)

Source from the content-addressed store, hash-verified

730 }
731
732 #flushBuffer(cb) {
733 validateFunction(cb, 'cb');
734
735 if (this.#destroyed) {
736 const error = new ERR_INVALID_STATE('Utf8Stream is destroyed');
737 if (cb) {
738 cb(error);
739 return;
740 }
741
742 throw error;
743 }
744
745 if (this.#minLength <= 0) {
746 cb?.();
747 return;
748 }
749
750 if (cb) {
751 this.#callFlushCallbackOnDrain(cb);
752 }
753
754 if (this.#writing) {
755 return;
756 }
757
758 if (this.#bufs.length === 0) {
759 ArrayPrototypePush(this.#bufs, []);
760 ArrayPrototypePush(this.#lens, 0);
761 }
762
763 this.#actualWrite();
764 }
765
766 #flushUtf8(cb) {
767 validateFunction(cb, 'cb');

Callers 1

constructorMethod · 0.95

Calls 2

cbFunction · 0.70

Tested by

no test coverage detected