multermate 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +7 -2
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -4,11 +4,12 @@ const { v4: uuidv4 } = require("uuid");
4
4
 
5
5
  // Constants for allowed MIME types
6
6
  const ALLOWED_MIME_TYPES = {
7
- images: ["image/jpeg", "image/png", "image/gif"],
7
+ images: ["image/jpeg", "image/jpg", "image/png", "image/gif"],
8
8
  videos: ["video/mp4", "video/mpeg", "video/ogg", "video/webm", "video/avi"],
9
9
  pdfs: ["application/pdf"],
10
10
  all: [
11
11
  "image/jpeg",
12
+ "image/jpg",
12
13
  "image/png",
13
14
  "image/gif",
14
15
  "video/mp4",
@@ -36,7 +37,11 @@ const configureStorage = (destination) => {
36
37
  const extension = path.extname(sanitizedFilename);
37
38
  const fieldName = file.fieldname || "file"; // Use the field name as part of the filename.
38
39
  const uniqueName = uuidv4(); // Generate a unique name using uuid.
39
- const fileName = `${uniqueName}-${fieldName}${extension}`;
40
+ let fileName = `${uniqueName}-${fieldName}${extension}`;
41
+
42
+ // Replace backslashes with forward slashes in the final filename
43
+ fileName = fileName.replace(/\\/g, "/");
44
+
40
45
  cb(null, fileName); // Set the final filename.
41
46
  },
42
47
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multermate",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "A flexible and customizable npm package for configuring Multer",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,7 +13,7 @@
13
13
  "node.js",
14
14
  "configurable"
15
15
  ],
16
- "author": "Your Name",
16
+ "author": "Wasim Zaman",
17
17
  "license": "MIT",
18
18
  "dependencies": {
19
19
  "multer": "1.4.5-lts.1",