npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

server-sink

1.0.0

@yoshuawuyts

npmHomeRepoSnykSocket
Downloads:1
$ npm install server-sink
DailyWeeklyMonthlyYearly

server-sink stability

npm version build status test coverage downloads js-standard-style

HTTP server response target. Creates a pipeable endpoint that logs out requests and responses with the proper response size.

Usage

const serverSink = require('server-sink')
const bole = require('bole')
const http = require('http')
const fs = require('fs')

const log = bole('app-main')

http.createServer(function (req, res) {
  const sink = serverSink(req, res, log.info)
  const rs = fs.createReadStream('./my-file')
  rs.pipe(sink)
})

API

sink = serverSink(req, res, log)

Create a new sink. Takes an HTTP incomingMessage, serverReponse and log method (bole is recommended, not mandatory).

Installation

$ npm install server-sink

License

MIT