(this: BaseHttpContent, destinationFilePath?: string)
| 24 | return this.toNativeImage().then((value) => new ImageSource(value)); |
| 25 | }, |
| 26 | toFile(this: BaseHttpContent, destinationFilePath?: string) { |
| 27 | if (!destinationFilePath) { |
| 28 | destinationFilePath = getFilenameFromUrl(this.requestURL); |
| 29 | } |
| 30 | if (this.raw instanceof NSData) { |
| 31 | // ensure destination path exists by creating any missing parent directories |
| 32 | const file = File.fromPath(destinationFilePath); |
| 33 | |
| 34 | this.raw.writeToFileAtomically(destinationFilePath, true); |
| 35 | |
| 36 | return file; |
| 37 | } else { |
| 38 | throw new Error(`Cannot save file with path: ${destinationFilePath}.`); |
| 39 | } |
| 40 | }, |
| 41 | }; |
| 42 | |
| 43 | export function request(options: HttpRequestOptions): Promise<HttpResponse> { |
nothing calls this directly
no test coverage detected