Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastify-multipart

Package Overview
Dependencies
Maintainers
14
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-multipart - npm Package Compare versions

Comparing version 5.2.0 to 5.2.1

20

index.d.ts

@@ -57,13 +57,13 @@ import { Busboy, BusboyConfig } from "@fastify/busboy";

// promise api
parts: (options?: BusboyConfig) => AsyncIterableIterator<Multipart>
parts: (options?: Omit<BusboyConfig, 'headers'>) => AsyncIterableIterator<Multipart>
// legacy
multipart: (handler: MultipartHandler, next: (err: Error) => void, options?: BusboyConfig) => Busboy;
multipart: (handler: MultipartHandler, next: (err: Error) => void, options?: Omit<BusboyConfig, 'headers'>) => Busboy;
// Stream mode
file: (options?: BusboyConfig) => Promise<Multipart>
files: (options?: BusboyConfig) => AsyncIterableIterator<Multipart>
file: (options?: Omit<BusboyConfig, 'headers'>) => Promise<Multipart>
files: (options?: Omit<BusboyConfig, 'headers'>) => AsyncIterableIterator<Multipart>
// Disk mode
saveRequestFiles: (options?: BusboyConfig & { tmpdir?: string }) => Promise<Array<Multipart>>
saveRequestFiles: (options?: Omit<BusboyConfig, 'headers'> & { tmpdir?: string }) => Promise<Array<Multipart>>
cleanRequestFiles: () => Promise<void>

@@ -94,2 +94,12 @@ tmpUploads: Array<Multipart>

/**
* Detect if a Part is a file.
*
* By default a file is detected if contentType
* is application/octet-stream or fileName is not
* undefined.
*
* Modify this to handle e.g. Blobs.
*/
isPartAFile?: (fieldName: string | undefined, contentType: string | undefined, fileName: string | undefined) => boolean;

@@ -96,0 +106,0 @@ limits?: {

{
"name": "fastify-multipart",
"version": "5.2.0",
"version": "5.2.1",
"description": "Multipart plugin for Fastify",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -49,3 +49,2 @@ import fastify from 'fastify'

}, {
headers: { 'content-type': 'multipart/form-data' },
limits: {

@@ -94,3 +93,3 @@ fileSize: 10000

app.post('/', async function (req, reply) {
const options: BusboyConfig = { headers: { 'content-type': 'multipart/form-data' }, limits: { fileSize: 1000 } };
const options: Partial<BusboyConfig> = { limits: { fileSize: 1000 } };
const data = await req.file(options)

@@ -147,3 +146,3 @@ await pump(data.file, fs.createWriteStream(data.filename))

app.post('/upload/files', async function (req, reply) {
const options: BusboyConfig = { headers: { 'content-type': 'multipart/form-data' }, limits: { fileSize: 1000 } };
const options: Partial<BusboyConfig> = { limits: { fileSize: 1000 } };
await req.saveRequestFiles(options)

@@ -150,0 +149,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc