MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / fromFile

Method fromFile

packages/core/image-source/index.ios.ts:144–156  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

142 return uiImage ? new ImageSource(uiImage) : null;
143 }
144 static fromFile(path: string): Promise<ImageSource> {
145 return new Promise<ImageSource>((resolve, reject) => {
146 try {
147 UIImage.tns_decodeImageWidthContentsOfFileCompletion(getFileName(path), (uiImage) => {
148 if (uiImage) {
149 resolve(new ImageSource(uiImage));
150 }
151 });
152 } catch (ex) {
153 reject(ex);
154 }
155 });
156 }
157
158 static fromFileOrResourceSync(path: string): ImageSource {
159 if (!isFileOrResourcePath(path)) {

Callers

nothing calls this directly

Calls 3

getFileNameFunction · 0.85
resolveFunction · 0.50
logMethod · 0.45

Tested by

no test coverage detected