@types/busboy

  • Version 1.5.3
  • Published
  • 9.49 kB
  • 1 dependency
  • MIT license

Install

npm i @types/busboy
yarn add @types/busboy
pnpm add @types/busboy

Overview

TypeScript definitions for busboy

Index

Functions

function busboy

busboy: (config: busboy.BusboyConfig) => busboy.Busboy;

    Interfaces

    interface Busboy

    interface Busboy extends Writable {}

      method addListener

      addListener: {
      <Event extends keyof BusboyEvents>(
      event: Event,
      listener: BusboyEvents[Event]
      ): this;
      (event: string | symbol, listener: (...args: any[]) => void): this;
      };

        method off

        off: {
        <Event extends keyof BusboyEvents>(
        event: Event,
        listener: BusboyEvents[Event]
        ): this;
        (event: string | symbol, listener: (...args: any[]) => void): this;
        };

          method on

          on: {
          <Event extends keyof BusboyEvents>(
          event: Event,
          listener: BusboyEvents[Event]
          ): this;
          (event: string | symbol, listener: (...args: any[]) => void): this;
          };

            method once

            once: {
            <Event extends keyof BusboyEvents>(
            event: Event,
            listener: BusboyEvents[Event]
            ): this;
            (event: string | symbol, listener: (...args: any[]) => void): this;
            };

              method prependListener

              prependListener: {
              <Event extends keyof BusboyEvents>(
              event: Event,
              listener: BusboyEvents[Event]
              ): this;
              (event: string | symbol, listener: (...args: any[]) => void): this;
              };

                method prependOnceListener

                prependOnceListener: {
                <Event extends keyof BusboyEvents>(
                event: Event,
                listener: BusboyEvents[Event]
                ): this;
                (event: string | symbol, listener: (...args: any[]) => void): this;
                };

                  method removeListener

                  removeListener: {
                  <Event extends keyof BusboyEvents>(
                  event: Event,
                  listener: BusboyEvents[Event]
                  ): this;
                  (event: string | symbol, listener: (...args: any[]) => void): this;
                  };

                    interface BusboyConfig

                    interface BusboyConfig {}

                      property defCharset

                      defCharset?: string | undefined;
                      • Default character set to use when one isn't defined.

                        'utf8'

                      property defParamCharset

                      defParamCharset?: string | undefined;
                      • For multipart forms, the default character set to use for values of part header parameters (e.g. filename) that are not extended parameters (that contain an explicit charset

                        'latin1'

                      property fileHwm

                      fileHwm?: number | undefined;
                      • 'highWaterMark' to use for individual file streams

                        stream.Readable

                      property headers

                      headers?: IncomingHttpHeaders | undefined;
                      • These are the HTTP headers of the incoming request, which are used by individual parsers.

                      property highWaterMark

                      highWaterMark?: number | undefined;
                      • 'highWaterMark' to use for the parser stream

                        stream.Writable

                      property limits

                      limits?: Limits | undefined;
                      • Various limits on incoming data.

                      property preservePath

                      preservePath?: boolean | undefined;
                      • If paths in filenames from file parts in a 'multipart/form-data' request shall be preserved.

                        false

                      interface BusboyEvents

                      interface BusboyEvents {}

                        property close

                        close: () => void;
                        • Use 'close' event instead of 'finish' event when you need to execute

                          1.0

                        property error

                        error: (error: unknown) => void;

                          property field

                          field: (name: string, value: string, info: FieldInfo) => void;
                          • Emitted for each new non-file field found.

                          property fieldsLimit

                          fieldsLimit: () => void;
                          • Emitted when specified fields limit has been reached. No more 'field' events will be emitted.

                          property file

                          file: (name: string, stream: Readable, info: FileInfo) => void;
                          • Emitted for each new file form field found.

                            * Note: if you listen for this event, you should always handle the stream no matter if you care about the file contents or not (e.g. you can simply just do stream.resume(); if you want to discard the contents), otherwise the 'finish' event will never fire on the Busboy instance. However, if you don't care about **any** incoming files, you can simply not listen for the 'file' event at all and any/all files will be automatically and safely discarded (these discarded files do still count towards files and parts limits). * If a configured file size limit was reached, stream will both have a boolean property truncated (best checked at the end of the stream) and emit a 'limit' event to notify you when this happens.

                            Parameter

                            listener.transferEncoding Contains the 'Content-Transfer-Encoding' value for the file stream.

                            Parameter

                            listener.mimeType Contains the 'Content-Type' value for the file stream.

                          property filesLimit

                          filesLimit: () => void;
                          • Emitted when specified files limit has been reached. No more 'file' events will be emitted.

                          property finish

                          finish: () => void;
                          • Deprecated

                            1.0

                          property partsLimit

                          partsLimit: () => void;
                          • Emitted when specified parts limit has been reached. No more 'file' or 'field' events will be emitted.

                          interface FieldInfo

                          interface FieldInfo extends Info {}

                            property nameTruncated

                            nameTruncated: boolean;

                              property valueTruncated

                              valueTruncated: boolean;

                                interface FileInfo

                                interface FileInfo extends Info {}

                                  property filename

                                  filename: string;

                                    interface Info

                                    interface Info {}

                                      property encoding

                                      encoding: string;

                                        property mimeType

                                        mimeType: string;

                                          interface Limits

                                          interface Limits {}

                                            property fieldNameSize

                                            fieldNameSize?: number | undefined;
                                            • Max field name size (in bytes).

                                              100

                                            property fields

                                            fields?: number | undefined;
                                            • Max number of non-file fields.

                                              Infinity

                                            property fieldSize

                                            fieldSize?: number | undefined;
                                            • Max field value size (in bytes).

                                              1048576 (1MB)

                                            property files

                                            files?: number | undefined;
                                            • For multipart forms, the max number of file fields.

                                              Infinity

                                            property fileSize

                                            fileSize?: number | undefined;
                                            • For multipart forms, the max file size (in bytes).

                                              Infinity

                                            property headerPairs

                                            headerPairs?: number | undefined;
                                            • For multipart forms, the max number of header key-value pairs to parse.

                                              2000 (same as node's http module)

                                            property parts

                                            parts?: number | undefined;
                                            • For multipart forms, the max number of parts (fields + files).

                                              Infinity

                                            Package Files (1)

                                            Dependencies (1)

                                            Dev Dependencies (0)

                                            No dev dependencies.

                                            Peer Dependencies (0)

                                            No peer dependencies.

                                            Badge

                                            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/busboy.

                                            • Markdown
                                              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/busboy)
                                            • HTML
                                              <a href="https://www.jsdocs.io/package/@types/busboy"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>