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

Method read

lib/internal/vfs/file_system.js:826–835  ·  view source on GitHub ↗

* Reads from a file descriptor asynchronously. * @param {number} fd The file descriptor * @param {Buffer} buffer The buffer to read into * @param {number} offset The offset in the buffer * @param {number} length The number of bytes to read * @param {number|null} position The position

(fd, buffer, offset, length, position, callback)

Source from the content-addressed store, hash-verified

824 * @param {Function} callback Callback (err, bytesRead, buffer)
825 */
826 read(fd, buffer, offset, length, position, callback) {
827 const vfd = getVirtualFd(fd);
828 if (!vfd) {
829 process.nextTick(callback, createEBADF('read'));
830 return;
831 }
832
833 vfd.entry.read(buffer, offset, length, position)
834 .then(({ bytesRead }) => callback(null, bytesRead, buffer), (err) => callback(err));
835 }
836
837 /**
838 * Writes to a file descriptor asynchronously.

Callers

nothing calls this directly

Calls 4

getVirtualFdFunction · 0.85
createEBADFFunction · 0.85
callbackFunction · 0.50
thenMethod · 0.45

Tested by

no test coverage detected