(arg: any, destinationFilePath?: string)
| 53 | } |
| 54 | |
| 55 | export function getFile(arg: any, destinationFilePath?: string): Promise<any> { |
| 56 | return new Promise<any>((resolve, reject) => { |
| 57 | request(typeof arg === 'string' ? { url: arg, method: 'GET' } : arg).then( |
| 58 | (r) => { |
| 59 | try { |
| 60 | const file = r.content.toFile(destinationFilePath); |
| 61 | resolve(file); |
| 62 | } catch (e) { |
| 63 | reject(e); |
| 64 | } |
| 65 | }, |
| 66 | (e) => reject(e), |
| 67 | ); |
| 68 | }); |
| 69 | } |
| 70 | |
| 71 | export function getBinary(arg: any): Promise<ArrayBuffer> { |
| 72 | return new Promise<ArrayBuffer>((resolve, reject) => { |