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

Function end

lib/internal/fs/promises.js:1012–1036  ·  view source on GitHub ↗
(options = kNullPrototo)

Source from the content-addressed store, hash-verified

1010 },
1011
1012 end(options = kNullPrototo) {
1013 if (error) {
1014 return PromiseReject(error);
1015 }
1016 if (closed) {
1017 return PromiseResolve(totalBytesWritten);
1018 }
1019 if (closing) {
1020 return pendingEndPromise;
1021 }
1022 validateObject(options, 'options');
1023 const {
1024 signal,
1025 } = options;
1026 if (signal !== undefined) {
1027 validateAbortSignal(signal, 'options.signal');
1028 if (signal.aborted) {
1029 return PromiseReject(signal.reason);
1030 }
1031 }
1032 closing = true;
1033 pendingEndPromise = PromisePrototypeThen(
1034 cleanup(), () => totalBytesWritten);
1035 return pendingEndPromise;
1036 },
1037
1038 endSync() {
1039 if (error) return -1;

Callers

nothing calls this directly

Calls 2

validateAbortSignalFunction · 0.85
cleanupFunction · 0.70

Tested by

no test coverage detected