MCPcopy Index your code
hub / github.com/nodejs/node / _final

Function _final

lib/internal/streams/iter/classic.js:821–844  ·  view source on GitHub ↗
(cb)

Source from the content-addressed store, hash-verified

819 }
820
821 function _final(cb) {
822 if (!hasEnd) {
823 queueMicrotask(cb);
824 return;
825 }
826 if (hasEndSync) {
827 try {
828 const result = writer.endSync();
829 if (result >= 0) {
830 queueMicrotask(cb);
831 return;
832 }
833 // Result < 0: can't end synchronously, fall through to async.
834 } catch (err) {
835 cb(err);
836 return;
837 }
838 }
839 try {
840 PromisePrototypeThen(writer.end(), () => cb(), cb);
841 } catch (err) {
842 cb(err);
843 }
844 }
845
846 function _destroy(err, cb) {
847 if (err && hasFail) {

Callers

nothing calls this directly

Calls 4

queueMicrotaskFunction · 0.85
cbFunction · 0.50
endSyncMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…