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

onbody

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onbody

a connect middleware for getting an http request's body as a buffer or string

latest
Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
14
55.56%
Maintainers
1
Weekly downloads
 
Created
Source

#onBodyMiddleware Build
Status Coverage Status NPM version

This is a simple connect middleware for getting an http request's body as a buffer or string because I got tired of doing it manually.

This middleware adds an onBody function to the req and calls back when done.

The onBody function takes a callback in the form

function(err, body){ ...

...where err is an error that may have occurred and body is the entire body of the request.

onBodyMiddleware is useful for any scenario where the streaming interface is unnecessary (basically anytime you need the entire body before you can do any processing).

###Setup:

var onBodyMiddleware = require('onBodyMiddleware');
connectApp.use(onBodyMiddleware);

###Use:

  function(req, res){
    req.onBody(function(err, body){
      if (err){
        res.end(JSON.stringify(err));
      } else {
        console.log(body);
        res.end("nice body!");
      }
    });
  }

Keywords

http

FAQs

Package last updated on 28 May 2013

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