(stream: Readable)
| 118 | } |
| 119 | |
| 120 | async function _streamToString(stream: Readable): Promise<string> { |
| 121 | const decoder = new TextDecoder() |
| 122 | let text = '' |
| 123 | |
| 124 | for await (const chunk of stream) { |
| 125 | text += decoder.decode(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk), { stream: true }) |
| 126 | } |
| 127 | |
| 128 | text += decoder.decode() |
| 129 | |
| 130 | return text |
| 131 | } |
| 132 | |
| 133 | async function _streamToFile(stream: Readable, fileName: string, contentType: string): Promise<File> { |
| 134 | const chunks: Buffer[] = [] |
no test coverage detected