šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

next-multipart

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-multipart

Next-multipart is a small utility library to ease the process of file uploads with Next.js. It uses [formidable](https://github.com/node-formidable/formidable) under the hood, but with much less work to do and a modern API

0.4.0
Source
npm
Version published
Weekly downloads
32
-20%
Maintainers
1
Weekly downloads
Ā 
Created
Source

Next-Multipart

Next-multipart is a small utility library to ease the process of file uploads with Next.js. It uses formidable under the hood, but with much less work to do and a modern API

Installation

Installation is pretty straight forward. Simply run one of the following commands to install it to your Next.js app.

yarn add next-multipart
npm i next-multipart
pnpm add next-multipart

Usage

TL;DR:

  • import { withFileUpload, getConfig } from 'next-multipart'
  • Simply wrap any api route with withFileUpload
  • export const config = getConfig()
  • You now can access req.file (if the request contained one file field) or req.files
  • Call await req.file.toBuffer() to load the file into the memory

FAQs

Package last updated on 03 Jan 2022

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