Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

form-data

Send files from Node.js to other services.

HTTP clients and networkingNPM

GitHubWebsite

1. License

“Permission is hereby granted, free of charge, to any person obtaining a copy”

Any use, including paid and closed-source apps.

github.com/form-data/form-data/blob/master/License

From the package registry and GitHub, checked daily; card checked Nov 11, 2026. Tap a verdict to see its source.How we checkedReport an error

What form-data does

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.

What people build with it

Pass an upload on to another service

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.

Send big files without loading them whole

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.

Upload a file with axios on the server

Your Node.js code already uses axios; form-data builds the upload body and the matching header for it.

Uploads with Node's own http module

Older code that talks to services through Node's built-in http module can stream the form straight into the request.

Send a voice note for transcription Idea

A chat bot receives a voice message and posts the audio file to a speech-to-text service from the server.

Tell the service the upload size

Some services refuse uploads without a size in the header; form-data can work it out before sending.

form-data popularity

66 / 100
Gid Score, #649 overall
238M
downloads a week, npm
2,360
GitHub stars
31
agent projects use it
form-data: downloads per weeknpm, form-data 237,867,377
form-data: GitHub starsform-data/form-data 2,360

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How form-data is used

  • 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%).

By coding agent

19 projects, 0.6%
16 projects, 0.7%
15 projects, 0.5%

Often used with

In 67.7% of its projects
In 64.5% of its projects
In 45.2% of its projects
In 41.9% of its projects
In 93.5% of its projects
In 45.2% of its projects
In 71.0% of its projects
In 38.7% of its projects

More about form-data

More in HTTP clients and networking

Alternatives

form-data This page

MITGid 66238M/wk

undici

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.

Got

Pick got when you want one Node.js request library with retries and streams around your uploads.

Needle

Pick needle when you want a light Node.js request library that handles form uploads itself.

Compare form-data with another tool

Get started

Tell your AI assistant

“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.”

  1. Install it in your Node.js project (pin 4.0.6 or newer).

    npm install --save form-data

    From github.com/form-data/form-data/blob/master/README.md

  2. Build the form with append(), then send it with submit() or hand it to your HTTP library with getHeaders().

    var form = new FormData();
    form.append('my_string', 'Hello World');
    
    form.submit('http://example.com/', function (err, res) {
      // res – response object (http.IncomingMessage)  //
      res.resume();
    } );
    

    From github.com/form-data/form-data/blob/master/README.md

Mistakes to avoid

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
npm install form-data@4.0.6 and check that no other package still pulls an old copy (npm ls form-data)

Old versions picked field separators with Math.random(), which an attacker could predict to add extra fields to a request.

axios.post(url, form) in Node.js without form.getHeaders()
axios.post(url, form, { headers: { ...form.getHeaders() } })

The receiving server needs the boundary from the Content-Type header to split the fields.

form.getBuffer() after appending fs.createReadStream(...)
Use form.submit() or form.pipe(request) for streams; use getBuffer() only with strings and Buffers

getBuffer works only for values a Buffer can hold.

form.append('my_buffer', new Buffer(10)) copied from the README
Buffer.alloc(10) or Buffer.from(data)

The Buffer constructor is deprecated in Node.js and prints a warning.

form.append('tags', ['a', 'b'])
form.append('tags', JSON.stringify(['a', 'b'])) or one append per value

The library does not accept arrays as values.

Questions

Do I still need form-data on Node.js 18 or newer?

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.

Which version is safe?

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.

Can I get the whole body as one piece to send?

Yes, getBuffer() returns it, but only for text and buffers, not for file streams.

Can I use it in a paid product?

Yes, it is MIT-licensed.