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

Method saveToFile

packages/core/image-source/index.ios.ts:356–371  ·  view source on GitHub ↗
(path: string, format: 'png' | 'jpeg' | 'jpg', quality?: number)

Source from the content-addressed store, hash-verified

354 }
355
356 public saveToFile(path: string, format: 'png' | 'jpeg' | 'jpg', quality?: number): boolean {
357 if (!this.ios) {
358 return false;
359 }
360
361 if (quality) {
362 quality = (quality - 0) / (100 - 0); // Normalize quality on a scale of 0 to 1
363 }
364
365 const data = getImageData(this.ios, format, quality);
366 if (data) {
367 return NSFileManager.defaultManager.createFileAtPathContentsAttributes(path, data, null);
368 }
369
370 return false;
371 }
372
373 public saveToFileAsync(path: string, format: 'png' | 'jpeg' | 'jpg', quality?: number): Promise<boolean> {
374 return new Promise<boolean>((resolve, reject) => {

Callers 5

pickImageMethod · 0.45
testSaveToFileFunction · 0.45
imageSourceFromAssetFunction · 0.45

Calls 1

getImageDataFunction · 0.85

Tested by

no test coverage detected