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

Function copyFile

lib/fs.js:3642–3658  ·  view source on GitHub ↗

* Asynchronously copies `src` to `dest`. By * default, `dest` is overwritten if it already exists. * @param {string | Buffer | URL} src * @param {string | Buffer | URL} dest * @param {number} [mode] * @param {(err?: Error) => any} callback * @returns {void}

(src, dest, mode, callback)

Source from the content-addressed store, hash-verified

3640 * @returns {void}
3641 */
3642function copyFile(src, dest, mode, callback) {
3643 if (typeof mode === 'function') {
3644 callback = mode;
3645 mode = 0;
3646 }
3647
3648 const h = vfsState.handlers;
3649 if (h !== null && vfsVoid(h.copyFile(src, dest, mode), callback)) return;
3650
3651 src = getValidatedPath(src, 'src');
3652 dest = getValidatedPath(dest, 'dest');
3653 callback = makeCallback(callback);
3654
3655 const req = new FSReqCallback();
3656 req.oncomplete = callback;
3657 binding.copyFile(src, dest, mode, req);
3658}
3659
3660/**
3661 * Synchronously copies `src` to `dest`. By

Callers 2

validateFunction · 0.50
getHandleFunction · 0.50

Calls 3

vfsVoidFunction · 0.85
makeCallbackFunction · 0.70
copyFileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…