Socket
Book a DemoInstallSign in
Socket

@fastify/busboy

Package Overview
Dependencies
Maintainers
15
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/busboy

A streaming parser for HTML form data for node.js

latest
Source
npmnpm
Version
3.2.0
Version published
Weekly downloads
14M
0.65%
Maintainers
15
Weekly downloads
 
Created

What is @fastify/busboy?

The @fastify/busboy package is a plugin for the Fastify web framework. It is primarily used for handling multipart/form-data, which is often used for uploading files through HTTP forms. It wraps the busboy library, providing an easy-to-use interface for parsing form submissions, especially file uploads, within Fastify applications.

What are @fastify/busboy's main functionalities?

File Upload

This feature allows for handling file uploads in a Fastify application. The code demonstrates how to register the @fastify/busboy plugin and set up a route to handle POST requests for file uploads. The multipart method is used to process the incoming file stream.

fastify.register(require('@fastify/busboy'));

fastify.post('/upload', function (req, reply) {
  const mp = req.multipart(handler, function (err) {
    console.log('upload completed');
    reply.code(200).send();
  });

  function handler (field, file, filename, encoding, mimetype) {
    // Perform actions with the file stream
  }
});

Field Parsing

This feature is used for parsing non-file fields from a multipart/form-data request. The example shows how to collect form fields into an object and handle the form parsing completion.

fastify.register(require('@fastify/busboy'));

fastify.post('/form', function (req, reply) {
  const data = {};
  const mp = req.multipart(function (field, value) {
    data[field] = value;
  }, function (err) {
    console.log('form parsing completed', data);
    reply.code(200).send(data);
  }, { limits: { fields: 5 } });
});

Other packages similar to @fastify/busboy

Keywords

uploads

FAQs

Package last updated on 16 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts