Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const path = require('path');
const processMultipart = require('./processMultipart');
const isEligibleRequest = require('./isEligibleRequest');
const { buildOptions, debugLog } = require('./utilities');
const busboy = require('busboy'); // eslint-disable-line no-unused-vars
const busboy = require('@fastify/busboy'); // eslint-disable-line no-unused-vars

const DEFAULT_OPTIONS = {
debug: false,
Expand Down
8 changes: 4 additions & 4 deletions lib/processMultipart.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Busboy = require('busboy');
const Busboy = require('@fastify/busboy');
const UploadTimer = require('./uploadtimer');
const fileFactory = require('./fileFactory');
const memHandler = require('./memHandler');
Expand Down Expand Up @@ -29,7 +29,7 @@ module.exports = (options, req, res, next) => {

// Build busboy options and init busboy instance.
const busboyOptions = buildOptions(options, { headers: req.headers });
const busboy = Busboy(busboyOptions);
const busboy = new Busboy(busboyOptions);

// Close connection with specified reason and http code, default: 400 Bad Request.
const closeConnection = (code, reason) => {
Expand All @@ -46,9 +46,9 @@ module.exports = (options, req, res, next) => {
busboy.on('field', (field, val) => req.body = buildFields(req.body, field, val));

// Build req.files fields
busboy.on('file', (field, file, info) => {
busboy.on('file', (field, file, name, info) => {
// Parse file name(cutting huge names, decoding, etc..).
const {filename:name, encoding, mimeType: mime} = info;
const {encoding, mimeType: mime} = info;
const filename = parseFileName(options, name);
// Define methods and handlers for upload process.
const {
Expand Down
29 changes: 9 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
"lint:fix": "eslint --fix ./",
"coveralls": "nyc report --reporter=text-lcov | coveralls"
},
"dependencies": {
"busboy": "^1.6.0"
},
"engines": {
"node": ">=12.0.0"
},
Expand All @@ -30,6 +27,9 @@
],
"license": "MIT",
"repository": "richardgirges/express-fileupload",
"dependencies": {
"@fastify/busboy": "^2.0.0"
},
"devDependencies": {
"coveralls": "^3.1.1",
"eslint": "^7.31.0",
Expand Down