New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

koa-bigpipe

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-bigpipe

a simple bigpipe impl with koa 2.x

latest
Source
npmnpm
Version
1.0.9
Version published
Maintainers
1
Created
Source

koa-bigpipe

a simple bigpipe impl with koa 2.x

gitter NPM version js-standard-style

Install

npm i -S koa-bigpipe

Usages

app.use(require('koa-bigpipe'))

API

  • ctx.write(chunk)
  • ctx.end()

ctx.write(chunk)

write chunk to browser. if chunk == null or undefined, it will end.

ctx.end()

end response

ctx.chunks

let count = ctx.chunks.length

Examples

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...<br>')
  
  return sleep(2000).then(function(){
    ctx.write(`timer: 2000ms<br>`)
    return sleep(5000)
  }).then(function(){
    ctx.write(`timer: 5000ms<br>`)
  }).then(function(){
    ctx.end()
  })
})

app.listen(3000)

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

版本历史

  • v1.0.0 init

欢迎fork和反馈

如有建议或意见,请在issue提问或邮件

License

this repo is released under the MIT License.

FAQs

Package last updated on 19 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts