New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-readbody

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

express-readbody - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

.eslintrc

5

index.js
module.exports = function readBody (req) {
if (typeof req !== 'object' || typeof req.on !== 'function') {
throw new TypeError(`expected an instance of stream.Readable, got ${typeof req} instead`);
}
return new Promise((resolve, reject) => {

@@ -10,4 +13,4 @@ let body = '';

req.on('end', () => resolve(body));
req.on('error', (e) => reject(e));
req.on('error', e => reject(e));
});
};

18

package.json
{
"name": "express-readbody",
"version": "1.0.0",
"version": "1.1.0",
"description": "Convenience function for easier reading of request data",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "ava test.js"
},

@@ -23,3 +23,15 @@ "repository": {

},
"homepage": "https://github.com/janis-kra/express-readbody#readme"
"homepage": "https://github.com/janis-kra/express-readbody#readme",
"devDpendencies": {
"eslint": "^3.13.1",
"eslint-config-janiskra": "^1.9.1"
},
"engines": {
"node": ">6.0.0"
},
"devDependencies": {
"ava": "^0.17.0",
"eslint": "^3.13.1",
"eslint-config-janiskra": "^1.10.0"
}
}
# express-readbody
Convenience function for easier reading of request data
Convenience function for easier reading of request data.
## Why?
Use this for a small project in which you just want the payload of a handful of POST or PUT requests to be read as a string.
For anything more complex or big, you probably want to use the excellent [body-parser middleware](https://www.npmjs.com/package/body-parser) or something similar.
## Installation
```
npm install --save express-readbody
```
## Usage

@@ -8,2 +20,3 @@

const server = require('express')();
const readBody = require('express-readbody');

@@ -10,0 +23,0 @@ server.post('/hello', (req, res) => {

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