{
 "kind": "tool",
 "slug": "form-data",
 "path": "tools/form-data/",
 "name": "form-data",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "HTTP clients and networking",
   "tools/http-clients/"
  ]
 ],
 "lead": "Send files from Node.js to other services.",
 "chips": [
  {
   "label": "HTTP clients and networking",
   "path": "tools/http-clients/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install form-data"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/form-data/form-data"
  },
  {
   "label": "Website",
   "href": "https://github.com/form-data/form-data#readme"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "Permission is hereby granted, free of charge, to any person obtaining a copy",
   "note": "Any use, including paid and closed-source apps.",
   "src": "https://github.com/form-data/form-data/blob/master/License"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Jun 12, 2026",
   "note": "",
   "src": "https://github.com/form-data/form-data"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "31 projects",
   "status": "info",
   "sub": "#18 of 126 in its category",
   "note": "Dependency in 31 public GitHub projects set up for AI coding agents that we scanned (0.5%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Install only",
   "status": "info",
   "sub": null,
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 11, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What form-data does",
   "parts": [
    {
     "t": "prose",
     "text": "form-data is a small free Node.js library that packs text fields and files into the same format a web form uses for uploads. Your server can then send a photo, a PDF or an audio file to another service, for example a storage or AI service. Newer Node.js versions have this built in, so new code often does not need it."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Pass an upload on to another service",
       "text": "Your server receives a file and forwards it, together with a few text fields, to a storage, email or AI service that expects a form upload.",
       "idea": false
      },
      {
       "title": "Send big files without loading them whole",
       "text": "A long video or a large archive is read from disk piece by piece while it is sent, so the server's memory stays small.",
       "idea": false
      },
      {
       "title": "Upload a file with axios on the server",
       "text": "Your Node.js code already uses axios; form-data builds the upload body and the matching header for it.",
       "idea": false
      },
      {
       "title": "Uploads with Node's own http module",
       "text": "Older code that talks to services through Node's built-in http module can stream the form straight into the request.",
       "idea": false
      },
      {
       "title": "Send a voice note for transcription",
       "text": "A chat bot receives a voice message and posts the audio file to a speech-to-text service from the server.",
       "idea": true
      },
      {
       "title": "Tell the service the upload size",
       "text": "Some services refuse uploads without a size in the header; form-data can work it out before sending.",
       "idea": false
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "form-data popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "66",
       "of": "/ 100",
       "l": "Gid Score, #649 overall"
      },
      {
       "n": "238M",
       "l": "downloads a week, npm"
      },
      {
       "n": "2,360",
       "l": "GitHub stars"
      },
      {
       "n": "31",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How form-data is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "form-data is a dependency in 31 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (0.6% of the 4,867 JavaScript/TypeScript ones), #18 of 126 in http clients and networking.",
      "Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 144; those are left out of every share on this page.",
      "Projects that use it most often also use Axios (67.7%), dotenv (64.5%), date-fns (45.2%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "19 projects, 0.6%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "16 projects, 0.7%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "15 projects, 0.5%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 67.7% of its projects",
       "v": "Axios",
       "path": "tools/axios/"
      },
      {
       "l": "In 64.5% of its projects",
       "v": "dotenv",
       "path": "tools/dotenv/"
      },
      {
       "l": "In 45.2% of its projects",
       "v": "date-fns",
       "path": "tools/date-fns/"
      },
      {
       "l": "In 41.9% of its projects",
       "v": "uuid",
       "path": "tools/uuid/"
      },
      {
       "l": "In 93.5% of its projects",
       "v": "TypeScript",
       "path": "tools/typescript/"
      },
      {
       "l": "In 45.2% of its projects",
       "v": "Radix UI",
       "path": "tools/radix-ui/"
      },
      {
       "l": "In 71.0% of its projects",
       "v": "React",
       "path": "tools/react/"
      },
      {
       "l": "In 38.7% of its projects",
       "v": "next-themes",
       "path": "tools/next-themes/"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "usage",
   "h2": "More about form-data",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "More in HTTP clients and networking",
       "path": "tools/http-clients/",
       "items": [
        {
         "text": "Axios",
         "path": "tools/axios/"
        },
        {
         "text": "Requests",
         "path": "tools/requests-py/"
        },
        {
         "text": "httpx",
         "path": "tools/httpx/"
        },
        {
         "text": "ws",
         "path": "tools/ws/"
        },
        {
         "text": "postgres",
         "path": "tools/postgres/"
        },
        {
         "text": "aiohttp",
         "path": "tools/aiohttp/"
        },
        {
         "text": "websockets",
         "path": "tools/websockets/"
        },
        {
         "text": "redis (Python)",
         "path": "tools/redis-pypi/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "form-data",
       "me": true,
       "facts": [
        "MIT",
        "Gid 66",
        "238M/wk"
       ]
      },
      {
       "name": "undici",
       "why": "Pick undici (or the fetch and FormData built into Node.js, which are based on it) for new code on Node.js 18 or newer.",
       "path": "tools/undici/",
       "facts": []
      },
      {
       "name": "Got",
       "why": "Pick got when you want one Node.js request library with retries and streams around your uploads.",
       "path": "tools/got/",
       "facts": []
      },
      {
       "name": "Needle",
       "why": "Pick needle when you want a light Node.js request library that handles form uploads itself.",
       "path": "tools/needle/",
       "facts": []
      }
     ],
     "more": "Compare form-data with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "In this Node.js server, post the uploaded file to the other service with form-data@4.0.6 (fs.createReadStream + form.getHeaders()), or with the built-in FormData and fetch if the project runs Node 18 or newer."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Install it in your Node.js project (pin 4.0.6 or newer).",
       "code": "npm install --save form-data",
       "src": "https://github.com/form-data/form-data/blob/master/README.md"
      },
      {
       "text": "Build the form with append(), then send it with submit() or hand it to your HTTP library with getHeaders().",
       "code": "var form = new FormData();\nform.append('my_string', 'Hello World');\n\nform.submit('http://example.com/', function (err, res) {\n  // res – response object (http.IncomingMessage)  //\n  res.resume();\n} );\n",
       "src": "https://github.com/form-data/form-data/blob/master/README.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "form-data below 4.0.4 (or 3.x below 3.0.4, 2.x below 2.5.4) pinned in package.json or a lockfile",
       "fix": "npm install form-data@4.0.6 and check that no other package still pulls an old copy (npm ls form-data)",
       "why": "Old versions picked field separators with Math.random(), which an attacker could predict to add extra fields to a request."
      },
      {
       "dont": "axios.post(url, form) in Node.js without form.getHeaders()",
       "fix": "axios.post(url, form, { headers: { ...form.getHeaders() } })",
       "why": "The receiving server needs the boundary from the Content-Type header to split the fields."
      },
      {
       "dont": "form.getBuffer() after appending fs.createReadStream(...)",
       "fix": "Use form.submit() or form.pipe(request) for streams; use getBuffer() only with strings and Buffers",
       "why": "getBuffer works only for values a Buffer can hold."
      },
      {
       "dont": "form.append('my_buffer', new Buffer(10)) copied from the README",
       "fix": "Buffer.alloc(10) or Buffer.from(data)",
       "why": "The Buffer constructor is deprecated in Node.js and prints a warning."
      },
      {
       "dont": "form.append('tags', ['a', 'b'])",
       "fix": "form.append('tags', JSON.stringify(['a', 'b'])) or one append per value",
       "why": "The library does not accept arrays as values."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Do I still need form-data on Node.js 18 or newer?",
       "a": "Often not. Node.js has its own FormData and fetch; form-data still helps with streaming big files and with older code built on axios or http.",
       "evidence": {
        "url": "https://nodejs.org/api/globals.html",
        "quote": "v18.0.0 No longer behind --experimental-fetch CLI flag."
       }
      },
      {
       "q": "Which version is safe?",
       "a": "4.0.4 or newer (4.0.6 is current). Older 4.x, 3.x before 3.0.4 and 2.x before 2.5.4 picked field separators with a guessable random number.",
       "evidence": {
        "url": "https://github.com/form-data/form-data/security/advisories/GHSA-fjxv-7rqg-78g4",
        "quote": "form-data uses Math.random() to select a boundary value for multipart form-encoded data."
       }
      },
      {
       "q": "Can I get the whole body as one piece to send?",
       "a": "Yes, getBuffer() returns it, but only for text and buffers, not for file streams.",
       "evidence": {
        "url": "https://github.com/form-data/form-data/blob/master/README.md",
        "quote": "Return the full formdata request package, as a Buffer."
       }
      },
      {
       "q": "Can I use it in a paid product?",
       "a": "Yes, it is MIT-licensed.",
       "evidence": {
        "url": "https://github.com/form-data/form-data/blob/master/README.md",
        "quote": "Form-Data is released under the MIT license."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm form-data"
  ],
  [
   "Category",
   "HTTP clients and networking"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Gid Score",
   "65.5"
  ],
  [
   "Rank in category",
   "#18 of 126"
  ],
  [
   "GitHub",
   "form-data/form-data"
  ],
  [
   "Last change",
   "Jun 12, 2026"
  ]
 ],
 "good": [
  "Node.js 18 and newer have their own FormData and fetch built in. New code on a current Node.js often does not need this library.",
  "Versions before 4.0.4 (and 3.0.4, 2.5.4) had a critical flaw in how they separated fields. Use 4.0.6.",
  "In the browser the package simply hands back the browser's own FormData; the file-streaming features only exist in Node.js."
 ],
 "checked_line": "Read by AgentGid from 9 official pages, card checked Nov 11, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/form-data.png"
}