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

Function readv

lib/fs.js:912–939  ·  view source on GitHub ↗

* Reads file from the specified `fd` (file descriptor) * and writes to an array of `ArrayBufferView`s. * @param {number} fd * @param {ArrayBufferView[]} buffers * @param {number | null} [position] * @param {( * err?: Error, * bytesRead?: number, * buffers?: ArrayBufferView[] * ) => an

(fd, buffers, position, callback)

Source from the content-addressed store, hash-verified

910 * @returns {void}
911 */
912function readv(fd, buffers, position, callback) {
913 function wrapper(err, read) {
914 callback(err, read || 0, buffers);
915 }
916
917 fd = getValidatedFd(fd);
918 validateBufferArray(buffers);
919 callback ||= position;
920 validateFunction(callback, 'cb');
921
922 if (typeof position !== 'number')
923 position = null;
924
925 const h = vfsState.handlers;
926 if (h !== null) {
927 const promise = h.readv(fd, buffers, position);
928 if (promise !== undefined) {
929 PromisePrototypeThen(promise,
930 (read) => callback(null, read, buffers), callback);
931 return;
932 }
933 }
934
935 const req = new FSReqCallback();
936 req.oncomplete = wrapper;
937
938 binding.readBuffers(fd, buffers, position, req);
939}
940
941ObjectDefineProperty(readv, kCustomPromisifyArgsSymbol,
942 { __proto__: null, value: ['bytesRead', 'buffers'], enumerable: false });

Callers 1

Calls 2

callbackFunction · 0.50
readvMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…