( fn: (line: Buffer) => void, )
| 26 | * The input/output is not changed and cannot be mutated by the callback. |
| 27 | */ |
| 28 | export function onEachLine( |
| 29 | fn: (line: Buffer) => void, |
| 30 | ): (source: AsyncGenerator<Buffer | string>) => AsyncGenerator<string | Buffer> { |
| 31 | return async function* (source) { |
| 32 | for await (const line of pipeEachLine(source)) { |
| 33 | fn(typeof line === 'string' ? Buffer.from(line) : line); |
| 34 | yield line; |
| 35 | } |
| 36 | }; |
| 37 | } |
no test coverage detected