form-data

  • Version 4.0.0
  • Published
  • 43.4 kB
  • 3 dependencies
  • MIT license

Install

npm i form-data
yarn add form-data
pnpm add form-data

Overview

A library to create readable "multipart/form-data" streams. Can be used to submit forms and file uploads to other web applications.

Index

Classes

class FormData

class FormData extends stream.Readable {}

    constructor

    constructor(options?: Options);

      method append

      append: (
      key: string,
      value: any,
      options?: FormData.AppendOptions | string
      ) => void;

        method getBoundary

        getBoundary: () => string;

          method getBuffer

          getBuffer: () => Buffer;

            method getHeaders

            getHeaders: (userHeaders?: FormData.Headers) => FormData.Headers;

              method getLength

              getLength: (callback: (err: Error | null, length: number) => void) => void;

                method getLengthSync

                getLengthSync: () => number;

                  method hasKnownLength

                  hasKnownLength: () => boolean;

                    method setBoundary

                    setBoundary: (boundary: string) => void;

                      method submit

                      submit: (
                      params: string | FormData.SubmitOptions,
                      callback?: (error: Error | null, response: http.IncomingMessage) => void
                      ) => http.ClientRequest;

                        Interfaces

                        interface AppendOptions

                        interface AppendOptions {}

                          property contentType

                          contentType?: string;

                            property filename

                            filename?: string;

                              property filepath

                              filepath?: string;

                                property header

                                header?: string | Headers;

                                  property knownLength

                                  knownLength?: number;

                                    interface Headers

                                    interface Headers {}

                                      index signature

                                      [key: string]: any;

                                        interface SubmitOptions

                                        interface SubmitOptions extends http.RequestOptions {}

                                          property protocol

                                          protocol?: 'https:' | 'http:';

                                            Package Files (1)

                                            Dependencies (3)

                                            Dev Dependencies (20)

                                            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/form-data.

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