(chunk, controller)
| 55 | // let ndjsonBuffer = '' |
| 56 | return new TransformStream({ |
| 57 | transform(chunk, controller) { |
| 58 | for (const item of chunk.split('\n')) { |
| 59 | try { |
| 60 | controller.enqueue(JSON.parse(item)) |
| 61 | } catch (error) { |
| 62 | // this exception is a common problem that we won't handle in this class: |
| 63 | // if the arrived data is not completed, it should stored in memory until completed |
| 64 | // 1st msg received - {"name": "er |
| 65 | // 2nd msg received - "ick"}\n |
| 66 | //result: {"name": "erick"}\n |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | } |
| 71 | }) |
| 72 | } |
| 73 | const [ |
nothing calls this directly
no outgoing calls
no test coverage detected