SYNOPSIS
Get the complete body from a stream and parse it automatically.
MOTIVATION
A minimal wrapper around raw-body that provides you with the correct parser.
BUILD STATUS
USAGE
This module detects the content type of the stream and parses it appropriately.
So for instance, if you request a resource with a content-type
header which
has the value of application/json
, the response body will be parsed as JSON
.
const http = const body = const url = 'http://nodejs.org/dist/index.json' http
EXTENDING
This module exports an object that exposes all parsers. For instance, the JSON
parser implemintation is defined on the parsers
member...
const body = bodyparsers'application/json' = { // `data` is the raw data object // `opts` is any options passed in to the parse function // `cb` is called after the stream has ended}