a simple bigpipe impl with koa 2.x
npm install koa-bigpipea simple bigpipe impl with koa 2.x



```
npm i -S koa-bigpipe
`js`
app.use(require('koa-bigpipe'))
- ctx.write(chunk)
- ctx.end()
write chunk to browser. if chunk == null or undefined, it will end.
end response
``
let count = ctx.chunks.length
`js
const Koa = require('koa')
const app = new Koa()
const sleep = ms => new Promise(r => setTimeout(r, ms))
app.use(require('.'))
// response
app.use(ctx => {
// ctx.body = 'Hello Koa'
ctx.write('loading...
')
return sleep(2000).then(function(){
ctx.write(timer: 2000ms)timer: 5000ms
return sleep(5000)
}).then(function(){
ctx.write()
}).then(function(){
ctx.end()
})
})
app.listen(3000)
`
1. Fork it
2. Create your feature branch (git checkout -b my-new-feature)git commit -am 'Add some feature'
3. Commit your changes ()git push origin my-new-feature
4. Push to the branch ()
5. Create new Pull Request
- v1.0.0 init
- write by i5ting` i5ting@126.com
如有建议或意见,请在issue提问或邮件
this repo is released under the MIT
License.