(chunk: Uint8Array | string, options?: WriteOptions)
| 118 | }, |
| 119 | |
| 120 | async write(chunk: Uint8Array | string, options?: WriteOptions): Promise<void> { |
| 121 | if (error) throw error; |
| 122 | if (closed) throw new Error('Writer is closed'); |
| 123 | |
| 124 | const bytes = typeof chunk === 'string' ? textEncoder.encode(chunk) : chunk; |
| 125 | const buffer = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength); |
| 126 | |
| 127 | const canContinue = writable.write(buffer); |
| 128 | byteCount += buffer.length; |
| 129 | |
| 130 | if (!canContinue) { |
| 131 | await waitForDrain(options?.signal); |
| 132 | if (error) throw error; |
| 133 | } |
| 134 | }, |
| 135 | |
| 136 | async writev(chunks: (Uint8Array | string)[], options?: WriteOptions): Promise<void> { |
| 137 | for (const chunk of chunks) { |
nothing calls this directly
no test coverage detected