| 28 | } |
| 29 | |
| 30 | export class WebDAVFileWriter implements FileWriter { |
| 31 | client: WebDAVClient; |
| 32 | |
| 33 | path: string; |
| 34 | |
| 35 | constructor(client: WebDAVClient, path: string) { |
| 36 | this.client = client; |
| 37 | this.path = path; |
| 38 | } |
| 39 | |
| 40 | async write(content: string | Blob): Promise<void> { |
| 41 | const data = content instanceof Blob ? await content.arrayBuffer() : content; |
| 42 | const resp = await this.client.putFileContents(this.path, data); |
| 43 | if (!resp) { |
| 44 | throw new Error("write error"); |
| 45 | } |
| 46 | } |
| 47 | } |
nothing calls this directly
no outgoing calls
no test coverage detected