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

Method copyFile

lib/internal/vfs/provider.js:387–398  ·  view source on GitHub ↗

* Copies a file. * @param {string} src Source path * @param {string} dest Destination path * @param {number} [mode] Copy mode flags * @returns {Promise }

(src, dest, mode)

Source from the content-addressed store, hash-verified

385 * @returns {Promise<void>}
386 */
387 async copyFile(src, dest, mode) {
388 if (this.readonly) {
389 throw createEROFS('copyfile', dest);
390 }
391 if ((mode & COPYFILE_EXCL) !== 0) {
392 if (await this.exists(dest)) {
393 throw createEEXIST('copyfile', dest);
394 }
395 }
396 const content = await this.readFile(src);
397 await this.writeFile(dest, content);
398 }
399
400 /**
401 * Copies a file synchronously.

Callers 15

copyFileFunction · 0.45
copyFileSyncFunction · 0.45
copyFileFunction · 0.45
copyFileFunction · 0.45
copyfileFunction · 0.45

Calls 5

existsMethod · 0.95
readFileMethod · 0.95
writeFileMethod · 0.95
createEROFSFunction · 0.85
createEEXISTFunction · 0.85

Tested by

no test coverage detected