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

pause-request-body

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pause-request-body

Middleware to pause streaming of the request body until a receiver is ready.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

pause-request-body

Not Maintained

pause-request-body is no longer being actively developed and has been archived. You are still welcome to use it but you may want to check for any forks that are more actively maintained. If it is of value to you, you are welcome to fork it or start a new project and incorporate its code into your project.

Description

Middleware to pause streaming of the request body until a receiver is ready.

Problem: if any asychronous operations occur in the middleware stack before the request body is parsed, the body will likely no longer be available. The request body stream must be paused until parsing can be done.

The pause-request-body package provides two simple middleware functions. The pauser function should be placed early in the middleware stack, before any middleware that involves asynchronous operations. The resumer function should occur just before the body is parsed. The request body stream will be paused between the two.

Getting Started

Install the module with: npm install pause-request-body

//Connect middleware stack:
var pause_request_body = require( 'pause-request-body' );
var app= connect()
  // ...
  .use(pause_request_body.pauser())
  //.use(other middleware that may include asynchronous operations)
  .use(pause_request_body.resumer())
  //.use(bodyParser or other middleware that parses or loads the body)
  // ...
  .listen(80)
//Express middleware stack:
var pause_request_body = require( 'pause-request-body' );
var app = express();
app.configure(function (){
  // ...
  app.use(pause_request_body.pauser())
  //app.use(other middleware that may include asynchronous operations)
  app.use(pause_request_body.resumer())
  //app.use(bodyParser or other middleware that parses or loads the body)
  // ...
})

Release History

(Nothing yet)

Build Status

License

Copyright (c) 2013 Randy McLaughlin Licensed under the MIT license.

FAQs

Package last updated on 10 Feb 2023

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