(key: string, path: string)
| 48 | } |
| 49 | |
| 50 | async get(key: string, path: string): Promise<GetResult> { |
| 51 | try { |
| 52 | const result = await this.instance.getObject({Bucket: this.bucket, Key: `${path}/${key}`}); |
| 53 | if (!result.Body) return {hit: false}; |
| 54 | return {hit: true, data: Buffer.from(await result.Body.transformToByteArray())}; |
| 55 | } catch (x: any) { |
| 56 | if (x instanceof NoSuchKey) return {hit: false}; |
| 57 | throw x; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | // Unused? |
| 62 | async delete(key: string, path: string): Promise<boolean> { |