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

Function end

lib/internal/streams/iter/classic.js:670–690  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

668
669 // options.signal is ignored for the same reason as write().
670 end() {
671 if ((writable.writableFinished ?? false) ||
672 (writable.destroyed ?? false)) {
673 cleanup();
674 return PromiseResolve(totalBytes);
675 }
676
677 const { promise, resolve, reject } = PromiseWithResolvers();
678
679 if (!(writable.writableEnded ?? false)) {
680 writable.end();
681 }
682
683 eos(writable, { writable: true, readable: false }, (err) => {
684 cleanup(err);
685 if (err) reject(err);
686 else resolve(totalBytes);
687 });
688
689 return promise;
690 },
691
692 fail(reason) {
693 cleanup(reason);

Callers

nothing calls this directly

Calls 5

eosFunction · 0.85
cleanupFunction · 0.70
rejectFunction · 0.70
resolveFunction · 0.70
endMethod · 0.45

Tested by

no test coverage detected