| 84 | } |
| 85 | |
| 86 | async putWithTTL(key: string, value: Buffer, ttlDays: number, creator?: string): Promise<void> { |
| 87 | const expiresDate = new Date(Date.now() + ttlDays * 24 * 60 * 60 * 1000); |
| 88 | const options: S3HandlerOptions = { |
| 89 | metadata: creator ? {CreatedBy: creator} : {}, |
| 90 | redundancy: StorageClass.REDUCED_REDUNDANCY, |
| 91 | expires: expiresDate, |
| 92 | }; |
| 93 | try { |
| 94 | await this.s3.put(key, value, this.path, options); |
| 95 | } catch (e) { |
| 96 | this.onError(e, 'write'); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | async putWithTTLAndPath( |
| 101 | key: string, |