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


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


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



class FormData

class FormData extends stream.Readable {}


    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;


                        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.


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

                                            You may also use to create a custom badge linking to

                                            • Markdown
                                            • HTML
                                              <a href=""><img src="" alt=""></a>