@types/express-multipart-file-parser
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

Installation

npm install --save @types/express-multipart-file-parser

Summary

This package contains type definitions for express-multipart-file-parser (https://github.com/cristovao-trevisan/express-multipart-file-parser#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-multipart-file-parser.

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

import type { BusboyConfig as BusboyOptions } from "busboy";
import type { Options as RawBodyOptions } from "raw-body";

interface UploadedFile {
    /** Field name specified in the form */
    fieldname: string;

    /** Name of the file on the user's computer */
    originalname: string;

    /** Encoding type of the file */
    encoding: string;

    /** Mime type of the file */
    mimetype: string;

    /** Contents of the file */
    buffer: Buffer;
}

interface FileParserOptions {
    /**
     * Options passed to the raw-body library
     * @see https://www.npmjs.com/package/raw-body#user-content-api
     */
    rawBodyOptions?: RawBodyOptions;
    /**
     * Options passed to the busboy library
     * @see https://github.com/mscdex/busboy/tree/v1.5.0#readme
     */
    busboyOptions?: BusboyOptions;
}

declare module "express-serve-static-core" {
    interface Request {
        files?: UploadedFile[];
    }
}

type RequestHandler = (req: any, res: any, next: any) => void;

type FileParserFactory = (options?: FileParserOptions) => RequestHandler[];

type FileParser = RequestHandler[] & { fileParser: FileParserFactory };

declare const fileParser: FileParser;

export = fileParser;

Additional Details

Credits

These definitions were written by Chen Asraf, and Cristóvão Trevisan.

Dependencies (3)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @types/express-multipart-file-parser

    Weekly Downloads

    2,184

    Version

    0.1.3

    License

    MIT

    Unpacked Size

    5.7 kB

    Total Files

    5

    Last publish

    Collaborators

    • types