MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / copyFile

Function copyFile

apps/toolbox/src/pages/fs-helper.ts:181–199  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

179}
180
181function copyFile(file) {
182 const picked = File.fromPath(file);
183 const ext = picked.extension;
184 const name = picked.name.replace(`.${ext}`, '');
185 const tempCopy = File.fromPath(path.join(knownFolders.temp().path, `${name}-copy.${ext}`));
186
187 // const done = picked
188 // .copySync(tempCopy.path);
189 // console.log('done: ' + done + '\n' + 'Original path: ' + picked.path + '\n' + 'Copied to: ' + tempCopy.path + '\n' + 'Original size: ' + picked.size + '\n' + 'Copy size: ' + tempCopy.size + '\n');
190
191 picked
192 .copy(tempCopy.path)
193 .then((done) => {
194 console.log('done: ' + done + '\n' + 'Original path: ' + picked.path + '\n' + 'Copied to: ' + tempCopy.path + '\n' + 'Original size: ' + picked.size + '\n' + 'Copy size: ' + tempCopy.size + '\n');
195 })
196 .catch((error) => {
197 console.log(error);
198 });
199}
200
201export function copyTest() {
202 const now = Date.now();

Callers

nothing calls this directly

Calls 5

replaceMethod · 0.80
joinMethod · 0.80
copyMethod · 0.65
fromPathMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected