@eggjs/multipart 5.0.0-beta.35 → 5.0.0-beta.36
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.
- package/dist/app/extend/context.d.ts +97 -93
- package/dist/app/extend/context.js +194 -271
- package/dist/app/middleware/multipart.d.ts +6 -3
- package/dist/app/middleware/multipart.js +14 -17
- package/dist/app/schedule/clean_tmpdir.d.ts +5 -2
- package/dist/app/schedule/clean_tmpdir.js +54 -51
- package/dist/app.d.ts +9 -5
- package/dist/app.js +20 -17
- package/dist/config/config.default.d.ts +87 -84
- package/dist/config/config.default.js +27 -25
- package/dist/index.d.ts +20 -16
- package/dist/index.js +24 -21
- package/dist/lib/LimitError.d.ts +7 -4
- package/dist/lib/LimitError.js +15 -12
- package/dist/lib/MultipartFileTooLargeError.d.ts +8 -5
- package/dist/lib/MultipartFileTooLargeError.js +17 -14
- package/dist/lib/utils.d.ts +8 -4
- package/dist/lib/utils.js +68 -88
- package/dist/types.d.ts +24 -22
- package/dist/types.js +1 -2
- package/package.json +25 -32
|
@@ -1,52 +1,55 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import dayjs from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
|
|
5
|
+
//#region src/app/schedule/clean_tmpdir.ts
|
|
6
|
+
var clean_tmpdir_default = (app) => {
|
|
7
|
+
return class CleanTmpdir extends app.Subscription {
|
|
8
|
+
static get schedule() {
|
|
9
|
+
return {
|
|
10
|
+
type: "worker",
|
|
11
|
+
cron: app.config.multipart.cleanSchedule.cron,
|
|
12
|
+
disable: app.config.multipart.cleanSchedule.disable,
|
|
13
|
+
immediate: false
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
async _remove(dir) {
|
|
17
|
+
const { ctx } = this;
|
|
18
|
+
if (await fs.access(dir).then(() => true, () => false)) {
|
|
19
|
+
ctx.coreLogger.info("[@eggjs/multipart:CleanTmpdir] removing tmpdir: %j", dir);
|
|
20
|
+
try {
|
|
21
|
+
await fs.rm(dir, {
|
|
22
|
+
force: true,
|
|
23
|
+
recursive: true
|
|
24
|
+
});
|
|
25
|
+
ctx.coreLogger.info("[@eggjs/multipart:CleanTmpdir:success] tmpdir: %j has been removed", dir);
|
|
26
|
+
} catch (err) {
|
|
27
|
+
ctx.coreLogger.error("[@eggjs/multipart:CleanTmpdir:error] remove tmpdir: %j error: %s", dir, err);
|
|
28
|
+
ctx.coreLogger.error(err);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async subscribe() {
|
|
33
|
+
const { ctx } = this;
|
|
34
|
+
const config = ctx.app.config;
|
|
35
|
+
ctx.coreLogger.info("[@eggjs/multipart:CleanTmpdir] start clean tmpdir: %j", config.multipart.tmpdir);
|
|
36
|
+
const lastYear = dayjs().subtract(1, "years");
|
|
37
|
+
const lastYearDir = path.join(config.multipart.tmpdir, lastYear.format("YYYY"));
|
|
38
|
+
await this._remove(lastYearDir);
|
|
39
|
+
for (let i = 1; i <= 3; i++) {
|
|
40
|
+
const date = dayjs().subtract(i, "months");
|
|
41
|
+
const dir = path.join(config.multipart.tmpdir, date.format("YYYY/MM"));
|
|
42
|
+
await this._remove(dir);
|
|
43
|
+
}
|
|
44
|
+
for (let i = 1; i <= 7; i++) {
|
|
45
|
+
const date = dayjs().subtract(i, "days");
|
|
46
|
+
const dir = path.join(config.multipart.tmpdir, date.format("YYYY/MM/DD"));
|
|
47
|
+
await this._remove(dir);
|
|
48
|
+
}
|
|
49
|
+
ctx.coreLogger.info("[@eggjs/multipart:CleanTmpdir] end");
|
|
50
|
+
}
|
|
51
|
+
};
|
|
51
52
|
};
|
|
52
|
-
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
export { clean_tmpdir_default as default };
|
package/dist/app.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Application, ILifecycleBoot } from "egg";
|
|
2
|
+
|
|
3
|
+
//#region src/app.d.ts
|
|
4
|
+
declare class AppBootHook implements ILifecycleBoot {
|
|
5
|
+
private readonly app;
|
|
6
|
+
constructor(app: Application);
|
|
7
|
+
configWillLoad(): void;
|
|
6
8
|
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { AppBootHook as default };
|
package/dist/app.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { normalizeOptions } from "./lib/utils.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
2
|
+
|
|
3
|
+
//#region src/app.ts
|
|
4
|
+
var AppBootHook = class {
|
|
5
|
+
app;
|
|
6
|
+
constructor(app) {
|
|
7
|
+
this.app = app;
|
|
8
|
+
}
|
|
9
|
+
configWillLoad() {
|
|
10
|
+
this.app.config.multipart = normalizeOptions(this.app.config.multipart);
|
|
11
|
+
const options = this.app.config.multipart;
|
|
12
|
+
this.app.coreLogger.info("[@eggjs/multipart] %s mode enable", options.mode);
|
|
13
|
+
if (options.mode === "file" || options.fileModeMatch) {
|
|
14
|
+
this.app.coreLogger.info("[@eggjs/multipart] will save temporary files to %j, cleanup job cron: %j", options.tmpdir, options.cleanSchedule.cron);
|
|
15
|
+
this.app.config.coreMiddleware.push("multipart");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { AppBootHook as default };
|
|
@@ -1,89 +1,92 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Context, EggAppInfo } from "egg";
|
|
2
|
+
import { PathMatchingPattern } from "@eggjs/path-matching";
|
|
3
|
+
|
|
4
|
+
//#region src/config/config.default.d.ts
|
|
5
|
+
type MatchItem = string | RegExp | ((ctx: Context) => boolean);
|
|
6
|
+
interface MultipartConfig {
|
|
7
|
+
/**
|
|
8
|
+
* which mode to handle multipart request, default is `stream`, the hard way.
|
|
9
|
+
* If set mode to `file`, it's the easy way to handle multipart request and save it to local files.
|
|
10
|
+
* If you don't know the Node.js Stream work, maybe you should use the `file` mode to get started.
|
|
11
|
+
*/
|
|
12
|
+
mode: "stream" | "file";
|
|
13
|
+
/**
|
|
14
|
+
* special url to use file mode when global `mode` is `stream`.
|
|
15
|
+
*/
|
|
16
|
+
fileModeMatch?: PathMatchingPattern;
|
|
17
|
+
/**
|
|
18
|
+
* Auto set fields to parts, default is `false`.
|
|
19
|
+
* Only work on `stream` mode.
|
|
20
|
+
* If set true,all fields will be auto handle and can access by `parts.fields`
|
|
21
|
+
*/
|
|
22
|
+
autoFields: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* default charset encoding, don't change it before you real know about it
|
|
25
|
+
* Default is `utf8`
|
|
26
|
+
*/
|
|
27
|
+
defaultCharset: string;
|
|
28
|
+
/**
|
|
29
|
+
* For multipart forms, the default character set to use for values of part header parameters (e.g. filename)
|
|
30
|
+
* that are not extended parameters (that contain an explicit charset), don't change it before you real know about it
|
|
31
|
+
* Default is `utf8`
|
|
32
|
+
*/
|
|
33
|
+
defaultParamCharset: string;
|
|
34
|
+
/**
|
|
35
|
+
* Max field name size (in bytes), default is `100`
|
|
36
|
+
*/
|
|
37
|
+
fieldNameSize: number;
|
|
38
|
+
/**
|
|
39
|
+
* Max field value size (in bytes), default is `100kb`
|
|
40
|
+
*/
|
|
41
|
+
fieldSize: string | number;
|
|
42
|
+
/**
|
|
43
|
+
* Max number of non-file fields, default is `10`
|
|
44
|
+
*/
|
|
45
|
+
fields: number;
|
|
46
|
+
/**
|
|
47
|
+
* Max file size (in bytes), default is `10mb`
|
|
48
|
+
*/
|
|
49
|
+
fileSize: string | number;
|
|
50
|
+
/**
|
|
51
|
+
* Max number of file fields, default is `10`
|
|
52
|
+
*/
|
|
53
|
+
files: number;
|
|
54
|
+
/**
|
|
55
|
+
* Add more ext file names to the `whitelist`, default is `[]`, only valid when `whitelist` is `null`
|
|
56
|
+
*/
|
|
57
|
+
fileExtensions: string[];
|
|
58
|
+
/**
|
|
59
|
+
* The white ext file names, default is `null`
|
|
60
|
+
*/
|
|
61
|
+
whitelist: string[] | ((filename: string) => boolean) | null;
|
|
62
|
+
/**
|
|
63
|
+
* Allow array field, default is `false`
|
|
64
|
+
*/
|
|
65
|
+
allowArrayField: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* The directory for temporary files. Only work on `file` mode.
|
|
68
|
+
* Default is `os.tmpdir()/egg-multipart-tmp/${appInfo.name}`
|
|
69
|
+
*/
|
|
70
|
+
tmpdir: string;
|
|
71
|
+
/**
|
|
72
|
+
* The schedule for cleaning temporary files. Only work on `file` mode.
|
|
73
|
+
*/
|
|
74
|
+
cleanSchedule: {
|
|
5
75
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
76
|
+
* The cron expression for the schedule.
|
|
77
|
+
* Default is `0 30 4 * * *`
|
|
78
|
+
* @see https://github.com/eggjs/egg/tree/next/plugins/schedule#cron-style-scheduling
|
|
79
|
+
*/
|
|
80
|
+
cron: string;
|
|
11
81
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* Only work on `stream` mode.
|
|
18
|
-
* If set true,all fields will be auto handle and can access by `parts.fields`
|
|
19
|
-
*/
|
|
20
|
-
autoFields: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* default charset encoding, don't change it before you real know about it
|
|
23
|
-
* Default is `utf8`
|
|
24
|
-
*/
|
|
25
|
-
defaultCharset: string;
|
|
26
|
-
/**
|
|
27
|
-
* For multipart forms, the default character set to use for values of part header parameters (e.g. filename)
|
|
28
|
-
* that are not extended parameters (that contain an explicit charset), don't change it before you real know about it
|
|
29
|
-
* Default is `utf8`
|
|
30
|
-
*/
|
|
31
|
-
defaultParamCharset: string;
|
|
32
|
-
/**
|
|
33
|
-
* Max field name size (in bytes), default is `100`
|
|
34
|
-
*/
|
|
35
|
-
fieldNameSize: number;
|
|
36
|
-
/**
|
|
37
|
-
* Max field value size (in bytes), default is `100kb`
|
|
38
|
-
*/
|
|
39
|
-
fieldSize: string | number;
|
|
40
|
-
/**
|
|
41
|
-
* Max number of non-file fields, default is `10`
|
|
42
|
-
*/
|
|
43
|
-
fields: number;
|
|
44
|
-
/**
|
|
45
|
-
* Max file size (in bytes), default is `10mb`
|
|
46
|
-
*/
|
|
47
|
-
fileSize: string | number;
|
|
48
|
-
/**
|
|
49
|
-
* Max number of file fields, default is `10`
|
|
50
|
-
*/
|
|
51
|
-
files: number;
|
|
52
|
-
/**
|
|
53
|
-
* Add more ext file names to the `whitelist`, default is `[]`, only valid when `whitelist` is `null`
|
|
54
|
-
*/
|
|
55
|
-
fileExtensions: string[];
|
|
56
|
-
/**
|
|
57
|
-
* The white ext file names, default is `null`
|
|
58
|
-
*/
|
|
59
|
-
whitelist: string[] | ((filename: string) => boolean) | null;
|
|
60
|
-
/**
|
|
61
|
-
* Allow array field, default is `false`
|
|
62
|
-
*/
|
|
63
|
-
allowArrayField: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* The directory for temporary files. Only work on `file` mode.
|
|
66
|
-
* Default is `os.tmpdir()/egg-multipart-tmp/${appInfo.name}`
|
|
67
|
-
*/
|
|
68
|
-
tmpdir: string;
|
|
69
|
-
/**
|
|
70
|
-
* The schedule for cleaning temporary files. Only work on `file` mode.
|
|
71
|
-
*/
|
|
72
|
-
cleanSchedule: {
|
|
73
|
-
/**
|
|
74
|
-
* The cron expression for the schedule.
|
|
75
|
-
* Default is `0 30 4 * * *`
|
|
76
|
-
* @see https://github.com/eggjs/egg/tree/next/plugins/schedule#cron-style-scheduling
|
|
77
|
-
*/
|
|
78
|
-
cron: string;
|
|
79
|
-
/**
|
|
80
|
-
* Default is `false`
|
|
81
|
-
*/
|
|
82
|
-
disable: boolean;
|
|
83
|
-
};
|
|
84
|
-
checkFile?(fieldname: string, file: any, filename: string, encoding: string, mimetype: string): void | Error;
|
|
82
|
+
* Default is `false`
|
|
83
|
+
*/
|
|
84
|
+
disable: boolean;
|
|
85
|
+
};
|
|
86
|
+
checkFile?(fieldname: string, file: any, filename: string, encoding: string, mimetype: string): void | Error;
|
|
85
87
|
}
|
|
86
88
|
declare const _default: (appInfo: EggAppInfo) => {
|
|
87
|
-
|
|
89
|
+
multipart: MultipartConfig;
|
|
88
90
|
};
|
|
89
|
-
|
|
91
|
+
//#endregion
|
|
92
|
+
export { MatchItem, MultipartConfig, _default as default };
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
|
|
4
|
+
//#region src/config/config.default.ts
|
|
5
|
+
var config_default_default = (appInfo) => {
|
|
6
|
+
return { multipart: {
|
|
7
|
+
mode: "stream",
|
|
8
|
+
autoFields: false,
|
|
9
|
+
defaultCharset: "utf8",
|
|
10
|
+
defaultParamCharset: "utf8",
|
|
11
|
+
fieldNameSize: 100,
|
|
12
|
+
fieldSize: "100kb",
|
|
13
|
+
fields: 10,
|
|
14
|
+
fileSize: "10mb",
|
|
15
|
+
files: 10,
|
|
16
|
+
fileExtensions: [],
|
|
17
|
+
whitelist: null,
|
|
18
|
+
allowArrayField: false,
|
|
19
|
+
tmpdir: path.join(os.tmpdir(), "egg-multipart-tmp", appInfo.name),
|
|
20
|
+
cleanSchedule: {
|
|
21
|
+
cron: "0 30 4 * * *",
|
|
22
|
+
disable: false
|
|
23
|
+
}
|
|
24
|
+
} };
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { config_default_default as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import "./types.js";
|
|
2
|
+
import { EggPluginFactory } from "egg";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
|
|
3
6
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
* Multipart plugin
|
|
8
|
+
*
|
|
9
|
+
* @since 4.1.0
|
|
10
|
+
* Usage:
|
|
11
|
+
* ```ts
|
|
12
|
+
* // config/plugin.ts
|
|
13
|
+
* import multipartPlugin from '@eggjs/multipart';
|
|
14
|
+
*
|
|
15
|
+
* export default {
|
|
16
|
+
* ...multipartPlugin(),
|
|
17
|
+
* };
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
17
20
|
declare const _default: EggPluginFactory;
|
|
18
|
-
|
|
21
|
+
//#endregion
|
|
22
|
+
export { _default as default };
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import "
|
|
2
|
-
|
|
1
|
+
import { definePluginFactory } from "egg";
|
|
2
|
+
|
|
3
|
+
//#region src/index.ts
|
|
3
4
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
5
|
+
* Multipart plugin
|
|
6
|
+
*
|
|
7
|
+
* @since 4.1.0
|
|
8
|
+
* Usage:
|
|
9
|
+
* ```ts
|
|
10
|
+
* // config/plugin.ts
|
|
11
|
+
* import multipartPlugin from '@eggjs/multipart';
|
|
12
|
+
*
|
|
13
|
+
* export default {
|
|
14
|
+
* ...multipartPlugin(),
|
|
15
|
+
* };
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
var src_default = definePluginFactory({
|
|
19
|
+
name: "multipart",
|
|
20
|
+
enable: true,
|
|
21
|
+
path: import.meta.dirname,
|
|
22
|
+
optionalDependencies: ["schedule"]
|
|
22
23
|
});
|
|
23
|
-
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { src_default as default };
|
package/dist/lib/LimitError.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region src/lib/LimitError.d.ts
|
|
2
|
+
declare class LimitError extends Error {
|
|
3
|
+
code: string;
|
|
4
|
+
status: number;
|
|
5
|
+
constructor(code: string, message: string);
|
|
5
6
|
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { LimitError };
|
package/dist/lib/LimitError.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
1
|
+
//#region src/lib/LimitError.ts
|
|
2
|
+
var LimitError = class extends Error {
|
|
3
|
+
code;
|
|
4
|
+
status;
|
|
5
|
+
constructor(code, message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.code = code;
|
|
8
|
+
this.status = 413;
|
|
9
|
+
this.name = this.constructor.name;
|
|
10
|
+
Error.captureStackTrace(this, this.constructor);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { LimitError };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/lib/MultipartFileTooLargeError.d.ts
|
|
2
|
+
declare class MultipartFileTooLargeError extends Error {
|
|
3
|
+
status: number;
|
|
4
|
+
fields: Record<string, any>;
|
|
5
|
+
filename: string;
|
|
6
|
+
constructor(message: string, fields: Record<string, any>, filename: string);
|
|
6
7
|
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { MultipartFileTooLargeError };
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
1
|
+
//#region src/lib/MultipartFileTooLargeError.ts
|
|
2
|
+
var MultipartFileTooLargeError = class extends Error {
|
|
3
|
+
status;
|
|
4
|
+
fields;
|
|
5
|
+
filename;
|
|
6
|
+
constructor(message, fields, filename) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = this.constructor.name;
|
|
9
|
+
this.status = 413;
|
|
10
|
+
this.fields = fields;
|
|
11
|
+
this.filename = filename;
|
|
12
|
+
Error.captureStackTrace(this, this.constructor);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { MultipartFileTooLargeError };
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { MultipartConfig } from "../config/config.default.js";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/utils.d.ts
|
|
4
|
+
declare const whitelist: string[];
|
|
5
|
+
declare function humanizeBytes(size: number | string): number;
|
|
6
|
+
declare function normalizeOptions(options: MultipartConfig): MultipartConfig;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { humanizeBytes, normalizeOptions, whitelist };
|