| Conditions | 2 |
| Total Lines | 19 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { Injectable } from '@nestjs/common'; |
||
| 12 | |||
| 13 | public getEndPoint(filePath: string): Promise<string> { |
||
| 14 | const bucket = this.configService.get<string>('STORAGE_BUCKET'); |
||
| 15 | |||
| 16 | const s3Api = this.s3Factory.create(); |
||
| 17 | |||
| 18 | const s3Params = { |
||
| 19 | Bucket: bucket, |
||
| 20 | Key: filePath, |
||
| 21 | Expires: 600, |
||
| 22 | ContentType: 'application/octet-stream' |
||
| 23 | }; |
||
| 24 | |||
| 25 | return new Promise<string>((resolve, reject) => { |
||
| 26 | s3Api.getSignedUrl('putObject', s3Params, (err, data) => { |
||
| 27 | if (err) { |
||
| 28 | reject(err); |
||
| 29 | } |
||
| 30 | resolve(data); |
||
| 31 | }); |
||
| 35 |