MCPcopy
hub / github.com/meteor/meteor / copyFile

Function copyFile

tools/fs/files.ts:1679–1691  ·  view source on GitHub ↗
(from: string, to: string, flags = 0)

Source from the content-addressed store, hash-verified

1677// the link itself, and it's an error if the link doesn't point to a file).
1678const wrappedCopyFile = wrapDestructiveFsFunc("copyFile", fs.copyFileSync, [0, 1]);
1679export function copyFile(from: string, to: string, flags = 0) {
1680 mkdir_p(pathDirname(pathResolve(to)), 0o755);
1681 wrappedCopyFile(from, to, flags);
1682 const stat = statOrNull(from);
1683 if (stat && stat.isFile()) {
1684 // Create the file as readable and writable by everyone, and executable by
1685 // everyone if the original file is executably by owner. (This mode will be
1686 // modified by umask.) We don't copy the mode *directly* because this function
1687 // is used by 'meteor create' which is copying from the read-only tools tree
1688 // into a writable app.
1689 chmod(to, (stat.mode & 0o100) ? 0o777 : 0o666);
1690 }
1691}
1692
1693const wrappedRename = wrapDestructiveFsFunc("rename", fs.renameSync, [0, 1]);
1694export const rename = isWindowsLikeFilesystem() ? function (from: string, to: string) {

Callers 1

cp_rFunction · 0.70

Calls 3

mkdir_pFunction · 0.85
pathDirnameFunction · 0.85
statOrNullFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…