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

Function close

lib/fs.js:619–629  ·  view source on GitHub ↗

* Closes the file descriptor. * @param {number} fd * @param {(err?: Error) => any} [callback] * @returns {void}

(fd, callback = defaultCloseCallback)

Source from the content-addressed store, hash-verified

617 * @returns {void}
618 */
619function close(fd, callback = defaultCloseCallback) {
620 if (callback !== defaultCloseCallback)
621 callback = makeCallback(callback);
622
623 const h = vfsState.handlers;
624 if (h !== null && vfsVoid(h.close(fd), callback)) return;
625
626 const req = new FSReqCallback();
627 req.oncomplete = callback;
628 binding.close(fd, req);
629}
630
631/**
632 * Synchronously closes the file descriptor.

Calls 3

vfsVoidFunction · 0.85
makeCallbackFunction · 0.70
closeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…