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

Function saveFile

apps/toolbox/src/pages/fs-helper.ts:164–179  ·  view source on GitHub ↗
(selected, readSync)

Source from the content-addressed store, hash-verified

162}
163
164function saveFile(selected, readSync) {
165 const folder: Folder = <Folder>knownFolders.documents();
166
167 let newPath: string = path.join(folder.path, getFileNameFromContent(selected));
168
169 File.fromPath(newPath).writeSync(readSync, (error) => {
170 console.log(error);
171 });
172
173 let savedFile = folder.getFile(getFileNameFromContent(selected));
174
175 console.log('==== SAVE START =========');
176 console.log('# saved file: ', savedFile);
177 console.log('# save size: ', savedFile.size);
178 console.log('==== SAVE END =========');
179}
180
181function copyFile(file) {
182 const picked = File.fromPath(file);

Callers 1

readFileFunction · 0.85

Calls 6

getFileNameFromContentFunction · 0.85
joinMethod · 0.80
writeSyncMethod · 0.65
getFileMethod · 0.65
fromPathMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected