@midwayjs/busboy 4.0.0-beta.1 → 4.0.0-beta.10
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/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/configuration.js +2 -0
- package/dist/interface.d.ts +0 -1
- package/dist/middleware.d.ts +0 -2
- package/dist/middleware.js +14 -12
- package/dist/parse.d.ts +0 -2
- package/dist/parse.js +3 -1
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +2 -2
- package/package.json +15 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013 - Now midwayjs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
package/dist/configuration.js
CHANGED
|
@@ -16,6 +16,8 @@ const constants_1 = require("./constants");
|
|
|
16
16
|
const path_1 = require("path");
|
|
17
17
|
const os_1 = require("os");
|
|
18
18
|
let BusboyConfiguration = class BusboyConfiguration {
|
|
19
|
+
uploadConfig;
|
|
20
|
+
logger;
|
|
19
21
|
async onReady() {
|
|
20
22
|
const { tmpdir, cleanTimeout, mode } = this.uploadConfig;
|
|
21
23
|
if (mode === 'file' && tmpdir) {
|
package/dist/interface.d.ts
CHANGED
package/dist/middleware.d.ts
CHANGED
package/dist/middleware.js
CHANGED
|
@@ -22,18 +22,20 @@ const busboy = require("busboy");
|
|
|
22
22
|
const constants_1 = require("./constants");
|
|
23
23
|
const { unlink, writeFile } = fs_1.promises;
|
|
24
24
|
let UploadMiddleware = class UploadMiddleware {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
uploadConfig;
|
|
26
|
+
logger;
|
|
27
|
+
/**
|
|
28
|
+
* cache global upload white list when uploadConfig.whitelist is set
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
uploadWhiteListMap = new Map();
|
|
32
|
+
/**
|
|
33
|
+
* cache global upload mime type white list when uploadConfig.mimeTypeWhiteList is set
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
uploadFileMimeTypeMap = new Map();
|
|
37
|
+
match;
|
|
38
|
+
ignore;
|
|
37
39
|
async init() {
|
|
38
40
|
if (this.uploadConfig.match) {
|
|
39
41
|
this.match = [].concat(this.uploadConfig.match || []);
|
package/dist/parse.d.ts
CHANGED
package/dist/parse.js
CHANGED
|
@@ -84,7 +84,9 @@ const parseHead = (headBuf) => {
|
|
|
84
84
|
if (name === 'content-disposition') {
|
|
85
85
|
const headCol = {};
|
|
86
86
|
value.split(/;\s+/).forEach((kv) => {
|
|
87
|
-
const
|
|
87
|
+
const eqIndex = kv.indexOf('=');
|
|
88
|
+
const k = eqIndex !== -1 ? kv.substring(0, eqIndex) : kv;
|
|
89
|
+
const v = eqIndex !== -1 ? kv.substring(eqIndex + 1) : undefined;
|
|
88
90
|
headCol[k] = v ? v.replace(/^"/, '').replace(/"$/, '') : v ?? true;
|
|
89
91
|
});
|
|
90
92
|
head[name] = headCol;
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.formatExt = exports.ensureDir = exports.checkExists = exports.stopAutoRemoveUploadTmpFile = exports.autoRemoveUploadTmpFile = void 0;
|
|
4
|
+
exports.streamToAsyncIterator = streamToAsyncIterator;
|
|
4
5
|
const fs_1 = require("fs");
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
const { readdir, access, stat, unlink, mkdir } = fs_1.promises;
|
|
@@ -93,5 +94,4 @@ async function* streamToAsyncIterator(stream) {
|
|
|
93
94
|
yield chunk;
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
|
-
exports.streamToAsyncIterator = streamToAsyncIterator;
|
|
97
97
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/busboy",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
4
|
-
"description": "Midway Component for
|
|
3
|
+
"version": "4.0.0-beta.10",
|
|
4
|
+
"description": "Midway Component for Busboy (multipart form data parser)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"index.d.ts"
|
|
19
19
|
],
|
|
20
20
|
"engines": {
|
|
21
|
-
"node": ">=
|
|
21
|
+
"node": ">=20"
|
|
22
22
|
},
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
@@ -27,14 +27,17 @@
|
|
|
27
27
|
"file-type": "16.5.4"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@midwayjs/core": "^4.0.0-beta.
|
|
31
|
-
"@midwayjs/express": "^4.0.0-beta.
|
|
32
|
-
"@midwayjs/faas": "^4.0.0-beta.
|
|
33
|
-
"@midwayjs/fc-starter": "^4.0.0-beta.
|
|
34
|
-
"@midwayjs/koa": "^4.0.0-beta.
|
|
35
|
-
"@midwayjs/mock": "^4.0.0-beta.
|
|
36
|
-
"@midwayjs/
|
|
37
|
-
"
|
|
30
|
+
"@midwayjs/core": "^4.0.0-beta.10",
|
|
31
|
+
"@midwayjs/express": "^4.0.0-beta.10",
|
|
32
|
+
"@midwayjs/faas": "^4.0.0-beta.10",
|
|
33
|
+
"@midwayjs/fc-starter": "^4.0.0-beta.10",
|
|
34
|
+
"@midwayjs/koa": "^4.0.0-beta.10",
|
|
35
|
+
"@midwayjs/mock": "^4.0.0-beta.10",
|
|
36
|
+
"@midwayjs/validation": "^4.0.0-beta.10",
|
|
37
|
+
"@midwayjs/validation-zod": "^4.0.0-beta.10",
|
|
38
|
+
"@midwayjs/web": "^4.0.0-beta.10",
|
|
39
|
+
"fs-extra": "11.3.3",
|
|
40
|
+
"zod": "3.25.76"
|
|
38
41
|
},
|
|
39
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "1b1856629913703f67304155aaf611ec936a81ac"
|
|
40
43
|
}
|