Socket
Book a DemoInstallSign in
Socket

@types/body-parser-xml

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/body-parser-xml

TypeScript definitions for body-parser-xml

ts4.5
ts4.6
ts4.7
ts4.8
ts4.9
ts5.0
ts5.1
ts5.2
ts5.3
ts5.4
ts5.5
ts5.6
ts5.7
ts5.8
ts5.9
ts6.0
latest
Source
npmnpm
Version
2.0.5
Version published
Maintainers
1
Created
Source

Installation

npm install --save @types/body-parser-xml

Summary

This package contains type definitions for body-parser-xml (https://github.com/fiznool/body-parser-xml).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/body-parser-xml.

index.d.ts

/// <reference types="node" />

// import bodyParser = require('body-parser');
import { BodyParser } from "body-parser";
import { NextHandleFunction } from "connect";
import { Request, Response } from "express-serve-static-core";
import { ParserOptions } from "xml2js";

/**
 * This library adds an xml method to the body-parser object.
 */
declare function bodyParserXml(bodyParser: BodyParser): void;

declare namespace bodyParserXml {
    interface Options {
        /**
         * Specify the default character set for the text content if the charset is not specified in the Content-Type header of the request.
         * @default 'utf-8'
         */
        defaultCharset?: BufferEncoding | undefined;
        /**
         * When set to true, then deflated (compressed) bodies will be inflated; when false, deflated bodies are rejected.
         * @default true
         */
        inflate?: boolean | undefined;
        /**
         * Controls the maximum request body size. If this is a number, then the value specifies the number of bytes; if it is a string, the value is passed to the bytes library for parsing.
         * @default '100kb'
         */
        limit?: string | number | undefined;
        /**
         * The type option is used to determine what media type the middleware will parse.
         * @default ['_/xml', '+xml']
         */
        type?: string | string[] | ((req: Request) => boolean) | undefined;
        /**
         * The verify option, if supplied, is called as verify(req, res, buf, encoding),
         * where buf is a Buffer of the raw request body and encoding is the encoding of the request.
         * The parsing can be aborted by throwing an error.
         */
        verify?: ((req: Request, res: Response, buf: Buffer, encoding: BufferEncoding) => void) | undefined;
        /**
         * This option controls the behaviour of the XML parser
         */
        xmlParseOptions?: ParserOptions | undefined;
    }
}

export = bodyParserXml;

declare module "body-parser" {
    interface BodyParser {
        xml(options?: bodyParserXml.Options): NextHandleFunction;
    }
}

Additional Details

Credits

These definitions were written by tbounsiar, and Piotr Błażejewicz.

FAQs

Package last updated on 07 Nov 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