const sseResponse = getSSEResponseStreamSomehow()
function fetchData() {
http.get("http://www.abc.com/path", res => {
call1(res)
call2(res)
})
}
function call1(data) {
const writer = fs.createWriteStream("filename.json")
writer.write(`{${String(new Date())}: `)
data.pipe(writer, {end: false})
data
.on('end', () => { writer.write('}') })
.on('error', err => log.error(err))
}
function call2(readStream) {
res.write("data: ")
readStream.pipe(res, {end: false})
readStream
.on('end', () => res.write("\n\n"))