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

Method close

lib/internal/vfs/file_system.js:803–815  ·  view source on GitHub ↗

* Closes a file descriptor asynchronously. * @param {number} fd The file descriptor * @param {Function} callback Callback (err)

(fd, callback)

Source from the content-addressed store, hash-verified

801 * @param {Function} callback Callback (err)
802 */
803 close(fd, callback) {
804 const vfd = getVirtualFd(fd);
805 if (!vfd) {
806 process.nextTick(callback, createEBADF('close'));
807 return;
808 }
809
810 vfd.entry.close()
811 .then(() => {
812 closeVirtualFd(fd);
813 callback(null);
814 }, (err) => callback(err));
815 }
816
817 /**
818 * Reads from a file descriptor asynchronously.

Callers

nothing calls this directly

Calls 6

getVirtualFdFunction · 0.85
createEBADFFunction · 0.85
closeVirtualFdFunction · 0.85
closeMethod · 0.65
callbackFunction · 0.50
thenMethod · 0.45

Tested by

no test coverage detected