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

urlencoded-body-parser

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

urlencoded-body-parser

Small application/x-www-form-urlencoded request body parser

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15K
increased by144.48%
Maintainers
1
Weekly downloads
 
Created
Source

Urlencoded Body Parser

Small parser for http.IncomingMessage that turns application/x-www-form-urlencoded data into a javascript object using qs.

Api

parse(req, {limit = '1mb'} = {})

  • Use require('urlencoded-body-parser')
  • Returns a Promise
  • Buffers and parses the incoming body and returns it.
  • limit is how much data is aggregated before parsing at max. It can be a Number of bytes or a string like '1mb'.
  • The Promise is rejected when an error occurs

Usage

Using Micro:

const parse = require('urlencoded-body-parser')
module.exports = async function (req, res) {
  const data = await parse(req)
  console.log(data)
  return ''
}

Using build in HTTP server:

const http = require('http');
const parse = require('urlencoded-body-parser')

const server = http.createServer((req, res) => {
  parse(req).then(data => {
    console.log(data)
    res.end();
  })
});

server.listen(8000);

FAQs

Package last updated on 03 Jul 2019

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