Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

quinn-respond

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

quinn-respond

Response generation for quinn

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

quinn: respond

API

respond({ statusCode, headers, body })

Create a new QuinnResponse. The body can be a string or a buffer. If no body is provided, it defaults to a through stream.

QuinnResponse

.pipe(res)

Forward response to node http response. If you pipe to something that isn't an HTTP response, this will only forward the response body and return a wrapped result. This enables things like:

function handle(req, res) {
    fs.createReadStream('README.md')
        .pipe(respond.text())
        .pipe(toUpperCase()) // pipe the body through a transform stream
        .pipe(res); // headers etc. are preserved
}

The minimum requirement for something to be seen as an HTTP response is the presence of a setHeader method.

Helpers

respond.text(body)

Create a text/plain response with the given body. The body can be a string or a buffer. If no body is provided, it defaults to a through stream.

respond.html(body)

Create text/html response with the given body. The body can be a string or a buffer. If no body is provided, it defaults to a through stream.

respond.json(data)

Serialize the data and create an application/json response. If no data is provided, it defaults to a through stream.

FAQs

Package last updated on 24 Jul 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc