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

Method write

lib/internal/vfs/file_system.js:846–855  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

844 * @param {Function} callback Callback (err, bytesWritten, buffer)
845 */
846 write(fd, buffer, offset, length, position, callback) {
847 const vfd = getVirtualFd(fd);
848 if (!vfd) {
849 process.nextTick(callback, createEBADF('write'));
850 return;
851 }
852
853 vfd.entry.write(buffer, offset, length, position)
854 .then(({ bytesWritten }) => callback(null, bytesWritten, buffer), (err) => callback(err));
855 }
856
857 /**
858 * Removes a file or directory 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