MCPcopy Create free account
hub / github.com/denoland/std / copyFile

Function copyFile

fs/copy.ts:100–113  ·  view source on GitHub ↗
(
  src: string | URL,
  dest: string | URL,
  options: InternalCopyOptions,
)

Source from the content-addressed store, hash-verified

98
99/* copy file to dest */
100async function copyFile(
101 src: string | URL,
102 dest: string | URL,
103 options: InternalCopyOptions,
104) {
105 await ensureValidCopy(src, dest, options);
106 await Deno.copyFile(src, dest);
107 if (options.preserveTimestamps) {
108 const statInfo = await Deno.stat(src);
109 assertIsDate(statInfo.atime, "statInfo.atime");
110 assertIsDate(statInfo.mtime, "statInfo.mtime");
111 await Deno.utime(dest, statInfo.atime, statInfo.mtime);
112 }
113}
114/* copy file to dest synchronously */
115function copyFileSync(
116 src: string | URL,

Callers 3

copyDirFunction · 0.70
copyFunction · 0.70

Calls 4

ensureValidCopyFunction · 0.85
assertIsDateFunction · 0.85
statMethod · 0.65
utimeMethod · 0.65

Tested by

no test coverage detected