@nestjs/platform-fastify 12.0.4 → 12.1.1
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/adapters/fastify-adapter.d.ts +50 -7
- package/adapters/fastify-adapter.js +149 -15
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/interfaces/external/fastify-multipart-options.interface.d.ts +53 -0
- package/interfaces/external/fastify-multipart-options.interface.js +1 -0
- package/interfaces/external/index.d.ts +1 -0
- package/interfaces/external/index.js +1 -0
- package/multipart/files.constants.d.ts +1 -0
- package/multipart/files.constants.js +1 -0
- package/multipart/index.d.ts +4 -0
- package/multipart/index.js +4 -0
- package/multipart/interceptors/any-files.interceptor.d.ts +12 -0
- package/multipart/interceptors/any-files.interceptor.js +13 -0
- package/multipart/interceptors/file-fields.interceptor.d.ts +13 -0
- package/multipart/interceptors/file-fields.interceptor.js +14 -0
- package/multipart/interceptors/file-stream.interceptor.d.ts +31 -0
- package/multipart/interceptors/file-stream.interceptor.js +32 -0
- package/multipart/interceptors/file.interceptor.d.ts +17 -0
- package/multipart/interceptors/file.interceptor.js +18 -0
- package/multipart/interceptors/files.interceptor.d.ts +14 -0
- package/multipart/interceptors/files.interceptor.js +15 -0
- package/multipart/interceptors/index.d.ts +6 -0
- package/multipart/interceptors/index.js +6 -0
- package/multipart/interceptors/no-files.interceptor.d.ts +12 -0
- package/multipart/interceptors/no-files.interceptor.js +13 -0
- package/multipart/interfaces/files-upload-module.interface.d.ts +18 -0
- package/multipart/interfaces/files-upload-module.interface.js +1 -0
- package/multipart/interfaces/index.d.ts +3 -0
- package/multipart/interfaces/index.js +3 -0
- package/multipart/interfaces/multipart-file.interface.d.ts +70 -0
- package/multipart/interfaces/multipart-file.interface.js +1 -0
- package/multipart/interfaces/multipart-options.interface.d.ts +77 -0
- package/multipart/interfaces/multipart-options.interface.js +1 -0
- package/multipart/multipart/append-field.util.d.ts +6 -0
- package/multipart/multipart/append-field.util.js +112 -0
- package/multipart/multipart/multipart-interceptor.factory.d.ts +13 -0
- package/multipart/multipart/multipart-interceptor.factory.js +130 -0
- package/multipart/multipart/multipart.constants.d.ts +55 -0
- package/multipart/multipart/multipart.constants.js +74 -0
- package/multipart/multipart/multipart.error.d.ts +10 -0
- package/multipart/multipart/multipart.error.js +15 -0
- package/multipart/multipart/multipart.parser.d.ts +39 -0
- package/multipart/multipart/multipart.parser.js +369 -0
- package/multipart/multipart/multipart.utils.d.ts +28 -0
- package/multipart/multipart/multipart.utils.js +54 -0
- package/multipart/multipart.constants.d.ts +1 -0
- package/multipart/multipart.constants.js +1 -0
- package/multipart/multipart.module.d.ts +18 -0
- package/multipart/multipart.module.js +75 -0
- package/multipart/storage/disk.storage.d.ts +24 -0
- package/multipart/storage/disk.storage.js +58 -0
- package/multipart/storage/index.d.ts +2 -0
- package/multipart/storage/index.js +2 -0
- package/multipart/storage/memory.storage.d.ts +8 -0
- package/multipart/storage/memory.storage.js +23 -0
- package/package.json +7 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Buffers each file into `file.buffer`. The default storage engine, as in
|
|
3
|
+
* multer.
|
|
4
|
+
*
|
|
5
|
+
* @publicApi
|
|
6
|
+
*/
|
|
7
|
+
export function memoryStorage() {
|
|
8
|
+
return {
|
|
9
|
+
_handleFile(_req, file, callback) {
|
|
10
|
+
const chunks = [];
|
|
11
|
+
file.stream.on('data', (chunk) => chunks.push(chunk));
|
|
12
|
+
file.stream.once('error', callback);
|
|
13
|
+
file.stream.once('end', () => {
|
|
14
|
+
const buffer = Buffer.concat(chunks);
|
|
15
|
+
callback(null, { buffer, size: buffer.length });
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
_removeFile(_req, file, callback) {
|
|
19
|
+
delete file.buffer;
|
|
20
|
+
callback(null);
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/platform-fastify",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.1.1",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@platform-fastify)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"main": "./index.js",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": "./index.js",
|
|
11
|
+
"./multipart": "./multipart/index.js",
|
|
11
12
|
"./*.js": "./*.js",
|
|
12
13
|
"./*": "./*.js"
|
|
13
14
|
},
|
|
@@ -36,12 +37,16 @@
|
|
|
36
37
|
"tslib": "2.8.1"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|
|
40
|
+
"@fastify/multipart": "^10.1.0",
|
|
39
41
|
"@fastify/static": "^10.1.2",
|
|
40
42
|
"@fastify/view": "^10.0.0 || ^11.0.0 || ^12.0.0",
|
|
41
43
|
"@nestjs/common": "^12.0.0",
|
|
42
44
|
"@nestjs/core": "^12.0.0"
|
|
43
45
|
},
|
|
44
46
|
"peerDependenciesMeta": {
|
|
47
|
+
"@fastify/multipart": {
|
|
48
|
+
"optional": true
|
|
49
|
+
},
|
|
45
50
|
"@fastify/static": {
|
|
46
51
|
"optional": true
|
|
47
52
|
},
|
|
@@ -49,5 +54,5 @@
|
|
|
49
54
|
"optional": true
|
|
50
55
|
}
|
|
51
56
|
},
|
|
52
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "9feedffde8ef8c86f0cd521153740575dc579d88"
|
|
53
58
|
}
|