Method
write
(filepath: string, content: Readable, type?: string)
Source from the content-addressed store, hash-verified
| 148 | } |
| 149 | |
| 150 | async write(filepath: string, content: Readable, type?: string): Promise<void> { |
| 151 | const { error } = await this.bucket.upload(this.fullPath(filepath), content, { |
| 152 | contentType: type ?? '', |
| 153 | cacheControl: '3600', |
| 154 | upsert: true, |
| 155 | duplex: 'half', |
| 156 | }); |
| 157 | |
| 158 | if (error) { |
| 159 | throw new Error(`Error uploading file "${filepath}"`, { cause: error }); |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | async delete(filepath: string): Promise<void> { |
| 164 | await this.bucket.remove([this.fullPath(filepath)]); |
Tested by
no test coverage detected