@azteam/express 1.2.453 → 1.2.455

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.
@@ -19,6 +19,8 @@ function _default(fieldName) {
19
19
  var opts = _objectSpread({
20
20
  isMultiple: false,
21
21
  maxFile: 5,
22
+ limitFileSize: 5,
23
+ // 5MB
22
24
  allowedMimes: [],
23
25
  storageDir: process.env.TEMPS_DIR,
24
26
  callBackFileName: function callBackFileName(req, file, cb) {
@@ -30,6 +32,7 @@ function _default(fieldName) {
30
32
  maxFile = opts.maxFile,
31
33
  storageDir = opts.storageDir,
32
34
  callBackFileName = opts.callBackFileName,
35
+ limitFileSize = opts.limitFileSize,
33
36
  tempsStorage = _multer["default"].diskStorage({
34
37
  destination: function destination(req, file, cb) {
35
38
  cb(null, storageDir);
@@ -40,9 +43,8 @@ function _default(fieldName) {
40
43
  storage: tempsStorage,
41
44
  limits: {
42
45
  files: 1,
43
- fileSize: 5 * 1024 * 1024 // 5MB
46
+ fileSize: limitFileSize * 1024 * 1024
44
47
  },
45
-
46
48
  fileFilter: function fileFilter(req, file, cb) {
47
49
  if (_lodash["default"].includes(allowedMimes, file.mimetype)) {
48
50
  cb(null, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azteam/express",
3
- "version": "1.2.453",
3
+ "version": "1.2.455",
4
4
  "license": "MIT",
5
5
  "author": "toda <sp.azsolution.net@gmail.com>",
6
6
  "main": "./lib/index.js",
@@ -12,7 +12,7 @@
12
12
  "@azteam/constant": "1.0.13",
13
13
  "@azteam/crypto": "1.0.40",
14
14
  "@azteam/error": "1.0.40",
15
- "@azteam/http-client": "1.0.118",
15
+ "@azteam/http-client": "1.0.202",
16
16
  "@azteam/util": "1.0.52",
17
17
  "@azteam/validator": "1.0.30",
18
18
  "@grpc/grpc-js": "1.6.7",
@@ -33,10 +33,10 @@
33
33
  "lodash": "4.17.21",
34
34
  "method-override": "3.0.0",
35
35
  "morgan": "1.10.0",
36
+ "multer": "1.4.5-lts.1",
36
37
  "pluralize": "8.0.0",
37
38
  "psl": "1.8.0",
38
39
  "socket.io": "4.4.1",
39
- "ua-parser-js": "1.0.32",
40
- "multer": "1.4.5-lts.1"
40
+ "ua-parser-js": "1.0.32"
41
41
  }
42
42
  }
@@ -7,6 +7,7 @@ export default function (fieldName, options = {}) {
7
7
  const opts = {
8
8
  isMultiple: false,
9
9
  maxFile: 5,
10
+ limitFileSize: 5, // 5MB
10
11
  allowedMimes: [],
11
12
  storageDir: process.env.TEMPS_DIR,
12
13
 
@@ -15,7 +16,7 @@ export default function (fieldName, options = {}) {
15
16
  },
16
17
  ...options,
17
18
  },
18
- {isMultiple, allowedMimes, maxFile, storageDir, callBackFileName} = opts,
19
+ {isMultiple, allowedMimes, maxFile, storageDir, callBackFileName, limitFileSize} = opts,
19
20
  tempsStorage = multer.diskStorage({
20
21
  destination(req, file, cb) {
21
22
  cb(null, storageDir);
@@ -26,7 +27,7 @@ export default function (fieldName, options = {}) {
26
27
  storage: tempsStorage,
27
28
  limits: {
28
29
  files: 1,
29
- fileSize: 5 * 1024 * 1024, // 5MB
30
+ fileSize: limitFileSize * 1024 * 1024,
30
31
  },
31
32
  fileFilter: (req, file, cb) => {
32
33
  if (_.includes(allowedMimes, file.mimetype)) {