formflux 0.2.18 → 0.2.20
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/README.md +10 -0
- package/dist/cjs/index.d.js.map +1 -1
- package/dist/esm/index.d.js.map +1 -1
- package/dist/package.json +9 -2
- package/dist/types/index.d.ts +32 -9
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -119,6 +119,16 @@ Here are some of the features of FormFlux:
|
|
|
119
119
|
8. **Error Handling**
|
|
120
120
|
- Provides error handling through error class FormfluxError which also provides statuscodes. Similar to Multer error class.
|
|
121
121
|
|
|
122
|
+
## TypeScript: Enabling `req.file` and `req.files`
|
|
123
|
+
|
|
124
|
+
Formflux augments the Express `Request` object with `file` and `files`.
|
|
125
|
+
|
|
126
|
+
To enable typing if not bale to access files or file from Request object, add this line to a global type declaration file in your project (e.g., `src/types/formflux.d.ts` or any `.d.ts` file included in `tsconfig.json`):
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
import "formflux";
|
|
130
|
+
```
|
|
131
|
+
|
|
122
132
|
## Limitation
|
|
123
133
|
|
|
124
134
|
Due to its custom implementation (not using `busboy`), the recommended **maximum file size is 200MB**. Going beyond that may lead to performance issues or high memory usage.
|
package/dist/cjs/index.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["export {};\
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["export {};\ndeclare module \"express-serve-static-core\" {\n interface Request {\n file?: {\n mimetype: string,\n originalname: string,\n filesize: number,\n filename: string,\n fieldname: string,\n filepath?: string,\n buffer?: Buffer\n };\n files?: Array<{\n mimetype: string,\n originalname: string,\n filesize: number,\n filename: string,\n fieldname: string,\n filepath?: string,\n buffer?: Buffer\n }> | {\n [fieldname: string]: Array<{\n mimetype: string,\n originalname: string,\n filename: string,\n filesize: number,\n fieldname: string,\n filepath?: string,\n buffer?: Buffer\n }>\n };\n }\n}"],"mappings":"","ignoreList":[]}
|
package/dist/esm/index.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["export {};\
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["export {};\ndeclare module \"express-serve-static-core\" {\n interface Request {\n file?: {\n mimetype: string,\n originalname: string,\n filesize: number,\n filename: string,\n fieldname: string,\n filepath?: string,\n buffer?: Buffer\n };\n files?: Array<{\n mimetype: string,\n originalname: string,\n filesize: number,\n filename: string,\n fieldname: string,\n filepath?: string,\n buffer?: Buffer\n }> | {\n [fieldname: string]: Array<{\n mimetype: string,\n originalname: string,\n filename: string,\n filesize: number,\n fieldname: string,\n filepath?: string,\n buffer?: Buffer\n }>\n };\n }\n}"],"mappings":"AAAA","ignoreList":[]}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "formflux",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.20",
|
|
4
4
|
"description": "A package to upload files to a server and parsing multipart-formData requests",
|
|
5
5
|
"main": "./dist/cjs/FormFlux.js",
|
|
6
6
|
"module": "./dist/esm/FormFlux.js",
|
|
@@ -24,6 +24,13 @@
|
|
|
24
24
|
"build:types": "tsc --emitDeclarationOnly --outDir dist/types",
|
|
25
25
|
"copy-types": "copyfiles -u 1 src/index.d.ts dist/types"
|
|
26
26
|
},
|
|
27
|
+
"typesVersions": {
|
|
28
|
+
"*": {
|
|
29
|
+
"*": [
|
|
30
|
+
"dist/types/*"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
27
34
|
"keywords": [
|
|
28
35
|
"FormFlux",
|
|
29
36
|
"formflux",
|
|
@@ -72,4 +79,4 @@
|
|
|
72
79
|
"files": [
|
|
73
80
|
"dist"
|
|
74
81
|
]
|
|
75
|
-
}
|
|
82
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
export {};
|
|
2
|
+
declare module "express-serve-static-core" {
|
|
3
|
+
interface Request {
|
|
4
|
+
file?: {
|
|
5
|
+
mimetype: string,
|
|
6
|
+
originalname: string,
|
|
7
|
+
filesize: number,
|
|
8
|
+
filename: string,
|
|
9
|
+
fieldname: string,
|
|
10
|
+
filepath?: string,
|
|
11
|
+
buffer?: Buffer
|
|
12
|
+
};
|
|
13
|
+
files?: Array<{
|
|
14
|
+
mimetype: string,
|
|
15
|
+
originalname: string,
|
|
16
|
+
filesize: number,
|
|
17
|
+
filename: string,
|
|
18
|
+
fieldname: string,
|
|
19
|
+
filepath?: string,
|
|
20
|
+
buffer?: Buffer
|
|
21
|
+
}> | {
|
|
22
|
+
[fieldname: string]: Array<{
|
|
23
|
+
mimetype: string,
|
|
24
|
+
originalname: string,
|
|
25
|
+
filename: string,
|
|
26
|
+
filesize: number,
|
|
27
|
+
fieldname: string,
|
|
28
|
+
filepath?: string,
|
|
29
|
+
buffer?: Buffer
|
|
30
|
+
}>
|
|
31
|
+
};
|
|
32
|
+
}
|
|
10
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "formflux",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.20",
|
|
4
4
|
"description": "A package to upload files to a server and parsing multipart-formData requests",
|
|
5
5
|
"main": "./dist/cjs/FormFlux.js",
|
|
6
6
|
"module": "./dist/esm/FormFlux.js",
|
|
@@ -24,6 +24,13 @@
|
|
|
24
24
|
"build:types": "tsc --emitDeclarationOnly --outDir dist/types",
|
|
25
25
|
"copy-types": "copyfiles -u 1 src/index.d.ts dist/types"
|
|
26
26
|
},
|
|
27
|
+
"typesVersions": {
|
|
28
|
+
"*": {
|
|
29
|
+
"*": [
|
|
30
|
+
"dist/types/*"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
27
34
|
"keywords": [
|
|
28
35
|
"FormFlux",
|
|
29
36
|
"formflux",
|
|
@@ -72,4 +79,4 @@
|
|
|
72
79
|
"files": [
|
|
73
80
|
"dist"
|
|
74
81
|
]
|
|
75
|
-
}
|
|
82
|
+
}
|