Socket
Socket
Sign inDemoInstall

fastify-multer

Package Overview
Dependencies
23
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.0.1

2

lib/index.js

@@ -10,3 +10,3 @@ "use strict";

const content_parser_1 = __importDefault(require("./lib/content-parser"));
function allowAll(req, file, cb) {
function allowAll(_req, _file, cb) {
cb(null, true);

@@ -13,0 +13,0 @@ }

@@ -20,3 +20,3 @@ "use strict";

return function multerPreHandler(request, _, next) {
const rawRequest = request.raw || request.req;
const rawRequest = request.raw;
if (!type_is_1.default(rawRequest, ['multipart'])) {

@@ -23,0 +23,0 @@ return next();

@@ -8,5 +8,5 @@ import { FastifyRequest } from 'fastify';

_handleFile(req: FastifyRequest, file: File, cb: (error: Error | null, info?: Partial<File>) => void): void;
_removeFile(req: FastifyRequest, file: File, cb: (error?: Error | null) => void): void;
_removeFile(_req: FastifyRequest, file: File, cb: (error?: Error | null) => void): void;
}
declare const _default: (opts: DiskStorageOptions) => DiskStorage;
export default _default;

@@ -11,3 +11,3 @@ "use strict";

const mkdirp_1 = __importDefault(require("mkdirp"));
const getFilename = (req, file, cb) => {
const getFilename = (_req, _file, cb) => {
crypto_1.default.randomBytes(16, function (err, raw) {

@@ -17,3 +17,3 @@ cb(err, err ? undefined : raw.toString('hex'));

};
const getDestination = (req, file, cb) => {
const getDestination = (_req, _file, cb) => {
cb(null, os_1.default.tmpdir());

@@ -26,3 +26,3 @@ };

mkdirp_1.default.sync(opts.destination);
this.getDestination = function ($0, $1, cb) {
this.getDestination = function (_$0, _$1, cb) {
cb(null, opts.destination);

@@ -59,3 +59,3 @@ };

}
_removeFile(req, file, cb) {
_removeFile(_req, file, cb) {
const path = file.path;

@@ -62,0 +62,0 @@ delete file.destination;

import { FastifyRequest } from 'fastify';
import { StorageEngine, File } from '../interfaces';
declare class MemoryStorage implements StorageEngine {
_handleFile(req: FastifyRequest, file: File, cb: (error: Error | null, info?: Partial<File>) => void): void;
_removeFile(req: FastifyRequest, file: File, cb: (error?: Error) => void): void;
_handleFile(_req: FastifyRequest, file: File, cb: (error: Error | null, info?: Partial<File>) => void): void;
_removeFile(_req: FastifyRequest, file: File, cb: (error?: Error) => void): void;
}
declare const _default: () => MemoryStorage;
export default _default;

@@ -5,3 +5,3 @@ "use strict";

class MemoryStorage {
_handleFile(req, file, cb) {
_handleFile(_req, file, cb) {
file.stream.pipe(concat({ encoding: 'buffer' }, function (data) {

@@ -14,3 +14,3 @@ cb(null, {

}
_removeFile(req, file, cb) {
_removeFile(_req, file, cb) {
delete file.buffer;

@@ -17,0 +17,0 @@ cb(undefined);

{
"name": "fastify-multer",
"description": "Fastify plugin for handling `multipart/form-data`.",
"version": "2.0.0",
"version": "2.0.1",
"main": "lib/index.js",

@@ -6,0 +6,0 @@ "types": "lib/",

@@ -19,3 +19,3 @@ import { FastifyRequest, preHandlerHookHandler } from 'fastify'

function allowAll(req: FastifyRequest, file: File, cb: FileFilterCallback) {
function allowAll(_req: FastifyRequest, _file: File, cb: FileFilterCallback) {
cb(null, true)

@@ -22,0 +22,0 @@ }

@@ -26,3 +26,3 @@ import { FastifyReply, FastifyRequest } from 'fastify'

) {
const rawRequest = request.raw || (request as any).req // this is needed just for testing
const rawRequest = request.raw

@@ -29,0 +29,0 @@ if (!is(rawRequest, ['multipart'])) {

@@ -10,3 +10,3 @@ import { FastifyRequest } from 'fastify'

const getFilename: GetFileName = (req, file, cb) => {
const getFilename: GetFileName = (_req, _file, cb) => {
crypto.randomBytes(16, function(err, raw) {

@@ -17,3 +17,3 @@ cb(err, err ? undefined : raw.toString('hex'))

const getDestination: GetDestination = (req, file, cb) => {
const getDestination: GetDestination = (_req, _file, cb) => {
cb(null, os.tmpdir())

@@ -31,3 +31,3 @@ }

mkdirp.sync(opts.destination)
this.getDestination = function($0, $1, cb) {
this.getDestination = function(_$0, _$1, cb) {
cb(null, opts.destination as string)

@@ -72,3 +72,3 @@ }

_removeFile(req: FastifyRequest, file: File, cb: (error?: Error | null) => void): void {
_removeFile(_req: FastifyRequest, file: File, cb: (error?: Error | null) => void): void {
const path = file.path!

@@ -75,0 +75,0 @@

@@ -8,3 +8,3 @@ import { FastifyRequest } from 'fastify'

_handleFile(
req: FastifyRequest,
_req: FastifyRequest,
file: File,

@@ -23,3 +23,3 @@ cb: (error: Error | null, info?: Partial<File>) => void,

_removeFile(req: FastifyRequest, file: File, cb: (error?: Error) => void) {
_removeFile(_req: FastifyRequest, file: File, cb: (error?: Error) => void) {
delete file.buffer

@@ -26,0 +26,0 @@ cb(undefined)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc