Express Stream

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2021 May 12 9:28
Editor
Edited
Edited
2021 May 13 1:28

server

Express gzip stream
res.write(serialize(data)) res.end()
 
 
 
res.setHeader('content-type', 'application/x-msgpack') for (const facility of facilities) { res.write(new Uint8Array(Buffer.from(JSON.stringify(facility)))) } return res.end()
아래와 같다
const inStream = new Readable({ read() { const iterated = facilityMaker.next() if (!iterated.done) this.push(new Uint8Array(Buffer.from(JSON.stringify(iterated.value)))) else this.push(null) } }) inStream.pipe(res)
 
 

Recommendations