(
key: string,
value: Buffer,
ttlDays: number,
pathPrefix: string,
creator?: string,
)
| 98 | } |
| 99 | |
| 100 | async putWithTTLAndPath( |
| 101 | key: string, |
| 102 | value: Buffer, |
| 103 | ttlDays: number, |
| 104 | pathPrefix: string, |
| 105 | creator?: string, |
| 106 | ): Promise<void> { |
| 107 | const expiresDate = new Date(Date.now() + ttlDays * 24 * 60 * 60 * 1000); |
| 108 | const options: S3HandlerOptions = { |
| 109 | metadata: creator ? {CreatedBy: creator} : {}, |
| 110 | redundancy: StorageClass.REDUCED_REDUNDANCY, |
| 111 | expires: expiresDate, |
| 112 | }; |
| 113 | try { |
| 114 | const customPath = `${this.path}/${pathPrefix}`; |
| 115 | await this.s3.put(key, value, customPath, options); |
| 116 | } catch (e) { |
| 117 | this.onError(e, 'write'); |
| 118 | } |
| 119 | } |
| 120 | } |
no test coverage detected