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

Function doWork

apps/toolbox/src/pages/fs-helper.ts:45–73  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

43}
44
45function doWork(path: string) {
46 try {
47 const file = File.fromPath(path) as File;
48 console.log('name: ', file.name);
49 console.log('path: ', file.path);
50 console.log('parent: ', file.parent);
51 console.log('size: ', file.size);
52 console.log('lastModified: ', file.lastModified);
53 console.log('extension: ', file.extension);
54 if (file.size > 0) {
55 console.log('current text: ', file.readTextSync());
56 } else {
57 file.writeTextSync('Hello World');
58 console.log('after write: ', file.readTextSync());
59 console.log('after write size: ', file.size);
60 }
61
62 file.renameSync(`ns_temp_${Date.now()}.txt`);
63
64 console.log('rename: ', file.name);
65 console.log('rename lastModified: ', file.lastModified);
66
67 file.removeSync();
68
69 console.log('deleted ?', !File.exists(path));
70 } catch (e) {
71 console.error(e);
72 }
73}
74
75export function pickFiles() {
76 if (!global.isAndroid) {

Callers 1

createRandomFunction · 0.85

Calls 8

removeSyncMethod · 0.80
errorMethod · 0.80
readTextSyncMethod · 0.65
writeTextSyncMethod · 0.65
fromPathMethod · 0.45
logMethod · 0.45
renameSyncMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected