@fastify/multipart
Advanced tools
Comparing version 9.0.0 to 9.0.1
{ | ||
"name": "@fastify/multipart", | ||
"version": "9.0.0", | ||
"version": "9.0.1", | ||
"description": "Multipart plugin for Fastify", | ||
@@ -24,3 +24,3 @@ "main": "index.js", | ||
"eslint": "^9.8.0", | ||
"fastify": "^5.0.0-alpha.4", | ||
"fastify": "^5.0.0", | ||
"form-data": "^4.0.0", | ||
@@ -27,0 +27,0 @@ "h2url": "^0.2.0", |
@@ -28,5 +28,3 @@ # @fastify/multipart | ||
const fs = require('node:fs') | ||
const util = require('node:util') | ||
const { pipeline } = require('node:stream') | ||
const pump = util.promisify(pipeline) | ||
const { pipeline } = require('node:stream/promises') | ||
@@ -54,3 +52,3 @@ fastify.register(require('@fastify/multipart')) | ||
await pump(data.file, fs.createWriteStream(data.filename)) | ||
await pipeline(data.file, fs.createWriteStream(data.filename)) | ||
@@ -94,3 +92,3 @@ // be careful of permission issues on disk and not overwrite | ||
**Note**: if the file stream that is provided by `data.file` is not consumed, like in the example below with the usage of pump, the promise will not be fulfilled at the end of the multipart processing. | ||
**Note**: if the file stream that is provided by `data.file` is not consumed, like in the example below with the usage of pipeline, the promise will not be fulfilled at the end of the multipart processing. | ||
This behavior is inherited from [`@fastify/busboy`](https://github.com/fastify/busboy). | ||
@@ -105,3 +103,3 @@ | ||
const data = await req.file() | ||
await pump(data.file, fs.createWriteStream(data.filename)) | ||
await pipeline(data.file, fs.createWriteStream(data.filename)) | ||
if (data.file.truncated) { | ||
@@ -129,3 +127,3 @@ // you may need to delete the part of the file that has been saved on disk | ||
const data = await req.file(options) | ||
await pump(data.file, fs.createWriteStream(data.filename)) | ||
await pipeline(data.file, fs.createWriteStream(data.filename)) | ||
reply.send() | ||
@@ -141,3 +139,3 @@ }) | ||
for await (const part of parts) { | ||
await pump(part.file, fs.createWriteStream(part.filename)) | ||
await pipeline(part.file, fs.createWriteStream(part.filename)) | ||
} | ||
@@ -155,3 +153,3 @@ reply.send() | ||
if (part.type === 'file') { | ||
await pump(part.file, fs.createWriteStream(part.filename)) | ||
await pipeline(part.file, fs.createWriteStream(part.filename)) | ||
} else { | ||
@@ -269,3 +267,3 @@ // part.type === 'field | ||
console.log(this.id) | ||
await pump(part.file, fs.createWriteStream(part.filename)) | ||
await pipeline(part.file, fs.createWriteStream(part.filename)) | ||
} | ||
@@ -272,0 +270,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
156076
528